Suppose you have an entity @Entity class A { ... }
and other entities with references to A. e.g.
@Entity class B { A a; // explicit reference to A List<A> list; // list of A's Set<A> set; // set of A's Set untyped; // general collection that may include A's }
Objectdb allows me to remove an instance of A, even if a managed B has some reference to that A. When I then find the B instance and try to reference the A, I get an EntityNotFoundException.
Is there a way to prevent the removal of the A, if it is referenced by any other object in the database? (ie. EntityManager.remove() should throw an exception.)
Thanks,
Carl