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: Issue with serializing/deserializing collections
PostPosted: Thu Nov 19, 2009 10:32 am 
Newbie

Joined: Thu Nov 19, 2009 10:23 am
Posts: 2
We have a strange problem we can't seem to understand.

We have two entities and the one has a collections of the other. We are trying to make a duplicate of this and want to save that duplicate. However, it seems Hibernate remembers some reference to the old collection and removes all items from the original object upon saving the new one. We have been looking with a debugger and it seems all objects are different then the original ones.

We are making the duplicate by initializing all objects in collections (so no lazy loading). After that we serialize and deserialize our object tree and nullify all variables inside the instances which are annotated by @Id. Thus we were hoping to complete seperate the original and the duplicate.

We have created a sample maven project which shows the problem.

I hope someone can enlight us a little bit. ;)


Top
 Profile  
 
 Post subject: Re: Issue with serializing/deserializing collections
PostPosted: Thu Nov 19, 2009 11:15 am 
Newbie

Joined: Thu Nov 19, 2009 10:23 am
Posts: 2
We've got something more after some investigating. It seems hibernate puts its own implementation of collections in the instances which remember from which instance they came from. So when we try to persist one, it removes it from the original instance. How can we completely detach these collections from their original instances? Do we need to find every collection and reinstantiate it? Or is there some cleaner way?


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.