Hi,
I have a problem with a simple list.
Parent:
Code:
...
<list name="bemaerkninger" cascade="all-delete-orphan" lazy="true">
<meta attribute="use-in-tostring">false</meta>
<meta attribute="use-in-equals">false</meta>
<key foreign-key="FK_DOK_BEMAERKNINGER" not-null="true">
<column name="FK_DOK_ID" sql-type="int" />
</key>
<list-index column="LBNR"/>
<one-to-many class="NyBemaerkning"/>
</list>
...
Child:
Code:
...
<many-to-one name="dokument" class="NyDokument" not-null="true" insert="false" update="false">
<meta attribute="use-in-tostring">false</meta>
<meta attribute="use-in-equals">false</meta>
</meta>
<column name="FK_DOK_ID" />
</many-to-one>
...
By adding update="false" to key in parent mapping, the sql is like this:
insert parent
insert child
insert child
insert child
but when I then delete a child (index 1) a delete sql is executed, but collection is not recreated (updated) with new list indexes. I expected atleat an update of the last child (index from 2 to 1)
If executed as is (in the above, hence with an update="false") the following sql is executed:
insert parent
insert child
insert child
insert child
update child
update child
update child
though the first inserts also do insert the correct FK_DOK_ID and LBNR.
I've taken a look at the AbstractCollectionPersister.recreate method which seems to the root cause of the extra updates. Should this not check if the collection is actually dirty?? The collection is infact initialized but not dirty!
Thanks in advance,
Lars Borup Jensen
http://www.it-arbejde.dk