I have a Java object with a field that should be automatically added to the database. This field is not a primary key, but simply a field that needs to be automatically increased.
My question is, what value do I need to set for this field in my Java object before doing session.save (Object)? Should I set it to NULL?
How to display this field in Hibernate? This is what I have but not working:
<property name="reportNum" type="java.lang.Long">
<column name="REPORTNUM"/>
<generator class="increment"/>
</property>
Also, the application must support both MySQL and SQL Server.
Thanks in advance.
source
share