Skip to main content

A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance : Solved

This usually happen when the child entities are not referred by the parent entities. This might happen if you are setting a new object using the setter method of this child entity.

For Example :

parent.setChildrens(new ArrayList<?>); // This create the problem because in this case the parent won't find any reference to the original entity.

Solution :

parent.getChildrens().clear();
parent.getChildrens().addAll( collection)

This will solve the problem

Comments