-->
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: lazy loading and saving
PostPosted: Tue Oct 07, 2008 3:39 pm 
Newbie

Joined: Tue Oct 07, 2008 3:22 pm
Posts: 2
Hi

I have an object A that contains a list of object B and B contain a list of object C. I’m doing some lazy loading. I get my object A and all the lists of object B. I don't need to get C. When saving, all C related to B are erased. How can I save A & B without touching C ?

Thank you for any help.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 07, 2008 4:01 pm 
Expert
Expert

Joined: Mon Nov 26, 2007 2:29 pm
Posts: 443
If B existed, and had Cs, and you didn't do anything strange to that collection in your code (such as reassigning an empty collection or accidentally removing all), then there is no reason why the Cs should be lost!

If, on the contrary, your problem is that newly created Cs are not persisted, then revise your "cascade" settings on the collection of Cs, by adding the operation you use to persist B (set it to cascade="save", cascade="persist" cascade="all", etc).

_________________
Gonzalo Díaz


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.