These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Question about one-to-one mapping implemented as many-to-one
PostPosted: Wed May 20, 2009 4:05 pm 
Newbie

Joined: Wed May 20, 2009 3:53 pm
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.