Hi,
I have a class A that has a many-to-many relationship with class B and their relationship is bidirectional.
I want to break the link between the 2 by deleting a record from their associative entity. For that I remove B's instance from the collection in A and also remove A's instance from the collection in B and then perform session.delete(A_object).
If for any reason the delete operation fails the objects of A and B are left in an inconsistent state from that of the DB. One way of recoveing their state is to load them again but that would mean increased DB access that is accessing DB once for delete, twice for loading A and B objects.
Is their any other better and efficient alternative to recovering Objects' state if delete fails and make their state consistent with that of the DB
Am I missing something here?
Thanx in advance for any suggstions and tips
|