|
We have a OneToMany relationship (List) with cascade ALL and orphanRemoval = false
If we remove a target entity from the List we expect the entity to be removed from the collection but not from the DB.
It works pretty well, when working with a managed parent.
However, if you remove the target entity from the list while the parent is detached and later on you merge the parent, then the target entity is neither removed from the list nor from the database. See test case attached (you can play with the removeBookWhileAuthorIsDetached flag to make the test pass/fail)
Note that with oprhanRemoval = true, if you remove the target entity from the list while the parent is detached and later on you merge the parent, then the target entity is properly removed from the list and from the database.
|