Hi All,
I am getting the following exception: "A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance:" only under one scenario.
We can open multiple panels and update it in our app., this exception is occurring only when I have multiple panels open and update a panel and save the obj.
If I have just one panel open and directly modify and save this exception does not occur.
I have looked into the forums regarding this exception and it is mentioned that the exception may occur only if the reference of the Child list owned by the parent is changed. I checked the getter/setter methods and the addToCollection methods to make sure this is not the case:
Code:
<bag embed-xml="true" name="HierarchyNodeList" optimistic-lock="true" cascade="all,delete-orphan">
<key column="SAK_THREAD" on-delete="noaction"> </key>
<one-to-many class="HierarchyNode" embed-xml="true"/>
</bag>
public List getHierarchyNodeList ()
{
return this.hierarchyNodeList;
}
public void setHierarchyNodeList (List hierarchyNodeList)
{
this.hierarchyNodeList = hierarchyNodeList;
}
public void addToHierarchyNodeList (gov.ma.eohhs.newmmis.ref.model.HierarchyNode hierarchyNode)
{
if (null == getHierarchyNodeList())
{
this.setHierarchyNodeList(new ArrayList());
}
if(hierarchyNode != null)
{
this.getHierarchyNodeList().add(hierarchyNode);
}
}
I have also checked to make sure the reference of the list remains the same during save. I am not sure why this error does not occur under all scenarios but only when I have multiple panels loaded.
Any feedback is appreciated.
Thanks.