-->
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: clone or copy persistent collection
PostPosted: Thu Mar 31, 2005 1:51 pm 
Newbie

Joined: Thu Feb 24, 2005 5:21 pm
Posts: 5
Hibernate version:
2.1.4

Hi. I'd like to know if there's any way to clone a persistent collection (Bag). The thing is that I need to clone an object and have the Bag cloned too. Is there any chance to create a new Bag from another one?

Thanks, Martin


Top
 Profile  
 
 Post subject: Re: clone or copy persistent collection
PostPosted: Fri Apr 01, 2005 9:34 am 
Newbie

Joined: Thu Feb 24, 2005 5:21 pm
Posts: 5
Searching in the forum, I found an example of cloning an object through serialization. I tried that approch, but I get an HibernateException: You may not change the reference to a collection with cascade="all-delete-orphan" . why does this happen? The thing is that I'm cloning them to get an exact replic of the Bag object, to be able to detect any orphans.
What I was doing previously serialization was override the clone method and assign a new ArrayList to the collection. but if an object was removed from that cloned collection, the orphan was not deleted, only the reference to the parent object was nullified, leaving trash in the database. Any help would be appreciated.

Martin


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.