-->
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: Change the parent of an child entity without remove
PostPosted: Sun Apr 15, 2007 6:03 am 
Beginner
Beginner

Joined: Thu Jan 04, 2007 5:44 am
Posts: 26
Location: Innsbruck - Sivas(TR) - Bregenz
Hi,

I have a 1:N association. For example a

customer class 1
and
order class N

and the order have also childs
order class 1
and
adress class N


in hibernate this is realized with a collections. Ok, how can I change the parent of the class order to another customer. When I use remove and use
"all-delete-orphan" ,hibernate removes me the order and his adresses.

How is the best method to change the parent of an child entity?

thx


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 15, 2007 2:57 pm 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Simply do not use all-delete-orphan. You're telling hibernate that your order lifecycle is bound to its parent. If your objects are not bound and should be able to live without each others, use a more reduced cascade options set. Even maybe nothing (equivalent to cascade="none", in fact) would be ok for you.

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


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.