|
I have the following question about a one to one mapping. As recommended by many Hibernate literature, I have one entity A that holds a reference to another entity B. The life cycle of B is the same as the one for A. So I have implemented the relation as a many-to-one with the flag inverse=true. Now imagine that I load an instance of A from the database and replace the persistent version of B with a new one and update A. As expected, a new row is inserted into the table for B, the foreign key is updated in the corresponding row for A, but the old row used for the first instance of B is never deleted from the B table.
Any ideas or remarks ? I used cascade="all" and don't have a reverse relation from B to A
Regards Jeff MAURY
|