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
|