-->
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.  [ 2 posts ] 
Author Message
 Post subject: One to one mapping and remove...
PostPosted: Wed Jan 11, 2006 2:16 am 
Newbie

Joined: Wed Jan 11, 2006 2:13 am
Posts: 1
I have Entity1 and Entity2.
Entity1 have ref (One To One) on Entity2.
If i remove Enity2, i recive exception "ConstraintViolationException".
How i can remove Entity2 without:

Code:
...
Entity1.setEntity2(null);
em.merge(Entity1.);
em.remove(Entity2);
...

Thanx.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 11, 2006 5:30 am 
Senior
Senior

Joined: Tue Aug 23, 2005 8:52 am
Posts: 181
Couple things you can try.
i) Setup cascade on the Entity2 so that when you delete Entity2, corresponding entity1's are also deleted
ii) Setup Entity1 to have constrained="false" so that Entity1 need not have a mapping Entity2


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

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.