Joined: Sat Feb 21, 2004 1:34 pm Posts: 12 Location: Denver, Colorado
|
For some reason whenever I insert a new object by calling Session.save() (using either String, Object or Object) Hibernate does a select first. The select does not use the unique ID for the table and this select takes quite some time to return causing the save to be very slow.
The object is defined with a java.lang.Interger ID field and the ID is confirmed to be null when the save is called. The definition for the ID field is:
<id name="oid" type="int" unsaved-value="null">
<column name="oid" sql-type="int" not-null="true"/>
<generator class="native"/>
</id>
My quesiton is:
How can I get Hibernate to stop doing this select prior to an insert when the ID field is null? or why would it be doing a select without using the ID field?
I am using Hibernate 3.1 and any suggestions would be greatly appreciated.
Note that I did search on this quite a bit and everything I found pointed to the unsaved-value tag above. Is there something else that would cause Hibernate to do this nasty select?
|
|