-->
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.  [ 4 posts ] 
Author Message
 Post subject: How delete object from collection
PostPosted: Thu Aug 19, 2004 5:02 pm 
Newbie

Joined: Wed Aug 11, 2004 4:48 pm
Posts: 12
I have set of detail records.

When i delete master, then details also deleted as well.

But i cannot delete just details. Tryed clear collection, but it doesn't work.
How i can do that?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 19, 2004 8:55 pm 
Newbie

Joined: Wed Aug 11, 2004 4:48 pm
Posts: 12
Is that about cascade="all-delete-orphans"?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 20, 2004 1:39 am 
Senior
Senior

Joined: Tue Sep 23, 2003 8:18 am
Posts: 137
Location: Johannesburg, South Africa
If you want to keep the parent, but delete the children, you would probably have to iterate through the set of children and delete each one by itself. I'm not sure you can do this: session.delete(parent.getChildren())

-G


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 20, 2004 2:16 am 
Regular
Regular

Joined: Thu Aug 05, 2004 2:27 am
Posts: 54
Location: South Africa
CNemo wrote:
Is that about cascade="all-delete-orphans"?


correct, and you must call remove on your set passing the object you want to remove, I quickly squizzed at removeAll, which takes another collection, maybe try passing the collection you have, you'll get back a boolean.
then just save your parent object.


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