0

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.

kgautron
  • 7,915
  • 9
  • 39
  • 60

1 Answers1

1

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.

James
  • 17,965
  • 11
  • 91
  • 146