-->
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.  [ 3 posts ] 
Author Message
 Post subject: How to delete a parent without delete yours childs?
PostPosted: Wed Jun 02, 2004 2:40 pm 
Beginner
Beginner

Joined: Wed Jan 21, 2004 10:52 pm
Posts: 27
Location: Santa Cruz do Sul - RS - Brazil
Hi all, sorry my bad english...
I need to delete a parent, but keep yours childs.
My problems is: I have an group, such as "programers'" and yours users "john", "mary" and "george".
I need to delete the "programers" group, but preserve the users "john", "mary" and "george" (because these users are used in other groups).
The relation between groups an users is N-N where exists cascade="save-update" in group way. This mechanisms throw constraints exceptions in DB when I try to delete a group "programers".

PS. I'm using 3tier architecture where the parent (group) is returned to UI without childs (users) - lazy="true".

_________________
Do you still create DTO factories? Oh, no!
Try DTOptimzier now!
https://dtoptimizer.dev.java.net/


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 02, 2004 2:41 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
at the beginning of this chapter:http://www.hibernate.org/hib_docs/reference/en/html/example-parentchild.html

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject: OK, but solution does not exactly it
PostPosted: Tue Jun 08, 2004 12:01 am 
Beginner
Beginner

Joined: Wed Jan 21, 2004 10:52 pm
Posts: 27
Location: Santa Cruz do Sul - RS - Brazil
All right, I found the solution, but my DBA did not like the solution (...)
Having in mind that (1) for each parent I need to load all collections of children and, for each collection item I need to make one update and (2) if this parent was child in others collections, I need to load all collections where the parent is child and, for each item of these collections I need to make one another update (...) It is a beautiful shit!

So, I cannot simply make an delete by native SQL in n-n resolution tables?

_________________
Do you still create DTO factories? Oh, no!
Try DTOptimzier now!
https://dtoptimizer.dev.java.net/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.