-->
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.  [ 2 posts ] 
Author Message
 Post subject: Issue while Saving a cloned object graph
PostPosted: Wed Aug 19, 2009 8:54 am 
Newbie

Joined: Tue Dec 09, 2008 6:55 am
Posts: 12
Hi,

I fetch an object graph through a query and do a deep clone and after resetting its id attribute (and that of its children) and after changing some attributes, I call session.save on the new object. However, this leads to an update statement which sets the foreign key of the previous object to null. My guess is its something to do with PersistentBag because if i set a new ArrayList to my cloned object, it doesnt fire the extra update.

My mappings -

<class
name="RePolicyVO"
table="RIN_POLICY_M_S"
lazy="false"

<bag name="policyProductsList" cascade="all" inverse="false">
<key update="true" property-ref="ShadowSeq" column="POLICYSEQ"/>
<one-to-many class="RePolicyProductVO" />
</bag>
>

Another thing is that I need to set update="true" on the key because the <key> is mapped using a property-ref and its a unidirectional one-to-many so Hibernate needs to fire an extra update to set the foreign key (Why it needs to do this in this case I dont know!).

Any help would be appreciated.

Thanks.

Regards
Kaizer


Top
 Profile  
 
 Post subject: Re: Issue while Saving a cloned object graph
PostPosted: Mon Aug 31, 2009 3:40 am 
Newbie

Joined: Tue Dec 09, 2008 6:55 am
Posts: 12
Any ideas anyone?? I'm really stuck because of this and can't figure out what to do.

Thanks,

Regards
Kaizer


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

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.