delete operation not happening in child object for relationship mapping [message #1862701] |
Thu, 21 December 2023 13:49 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Sanjana C![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=Sanjana.ashna%40gmail.com) Messages: 31 Registered: December 2022 |
Member |
|
|
Hi Team,
As a part of migration from toplink to eclipselink , we have a case where entity in child mapping is deleted and later merge is called on parent object .Commit happens after this and can see child object is not deleted from database .
When looked into the issue , parent object still holds child in list and merges it .
please find the mapping below:
Mapping in parent table:
<attribute-mapping xsi:type="one-to-many-mapping">
<attribute-name>child</attribute-name>
<reference-class>de.*.*.*..impl.child</reference-class>
<private-owned>true</private-owned>
<cascade-persist>true</cascade-persist>
<target-foreign-key>
<field-reference>
<source-field table="child" name="MIG_ID" xsi:type="column"/>
<target-field table="Parent" name="ID" xsi:type="column"/>
</field-reference>
</target-foreign-key>
<container xsi:type="list-container-policy">
<collection-type>org.eclipse.persistence.indirection.IndirectList</collection-type>
</container>
<indirection xsi:type="transparent-collection-indirection-policy"/>
<selection-query xsi:type="read-all-query">
<container xsi:type="list-container-policy">
<collection-type>org.eclipse.persistence.indirection.IndirectList</collection-type>
</container>
</selection-query>
</attribute-mapping>
mapping in child table
<attribute-mapping xsi:type="one-to-one-mapping">
<attribute-name>migranten</attribute-name>
<reference-class>de.*.*.*.impl.MigrantenImpl</reference-class><cascade-persist>true</cascade-persist>
<foreign-key>
<field-reference>
<source-field table="child" name="MIG_ID" xsi:type="column"/>
<target-field table="parent" name="ID" xsi:type="column"/>
</field-reference>
</foreign-key>
<foreign-key-fields>
<field table="child" name="MIG_ID" xsi:type="column"/>
</foreign-key-fields>
<indirection xsi:type="value-holder-indirection-policy"/>
<selection-query xsi:type="read-object-query"/>
</attribute-mapping>
I see same happens in toplink(same mapping configuration) but it delets the child object . Could you please let me know if am missing something .
Thanks,
Sanjana
[Updated on: Thu, 21 December 2023 13:50] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03227 seconds