-->
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: inserting in the middle of a <list>
PostPosted: Tue Sep 30, 2003 10:20 am 
Newbie

Joined: Fri Sep 26, 2003 11:47 am
Posts: 2
I noticed that when I add an object in the middle of a <list> at position N, Hibernate updates the indices of the objects that come after it, i.e. the objects that had indices >= N, in two steps.
First it sets the values of the index columns and the column that is the foreign key to the parent table to NULL for all the objects.
In the second pass, Hibernate sets the parent ID column back to what it was and sets the new index value.
The result is that the indices of the items that follow the newly inserted item are incremented by one, which is of course exactly what I want.

However, in the first pass it sets the index column value and the parent ID value to NULL, which causes constraint violations if I define these columns to be "NOT NULL" (in Oracle). Defining these column with not-null="false" in the hbm.xml files does not seem to matter.

Why is this? Can't Hibernate update the index column values in one pass, without setting them to NULL first?

Thanks for a great O/R mapping tool!
-Enno


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.