-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Select called on an insert
PostPosted: Wed Sep 20, 2006 6:04 pm 
Newbie

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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.