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
|