-->
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: Collections
PostPosted: Tue Jun 17, 2008 9:08 am 
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


Top
  
 
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.