Reputation: 8283
I have a OneToMany
relation from A to B (A references a list Bs).
When I delete a B using either entityManager.remove(b)
or a.getBs().remove(b)
or both, and load A again : the deleted B will still appear in the list THOUGH it has been effectively removed from the database! I tried with and without Cascade.ALL
on the relation with no success..
Thanks for your help.
Upvotes: 0
Views: 369
Reputation: 18379
You need to do both (unless you use delete orphans). If you do both it should be gone. Ensure you remove it from the correct managed a, not a detached a. Ensure the a actually contains the b to begin with.
You could always call refresh() to confirm that the database state was correct.
Upvotes: 1