-->
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: Cloning and Reattaching Objects
PostPosted: Thu Sep 01, 2005 7:01 pm 
Newbie

Joined: Sat Jun 18, 2005 9:15 am
Posts: 8
Hi !!!

I have the next question: i'm using object clones (serializing and deserializing them) to edit them and then if the page is accepted save them, if not i keep the original.
This is bringing me some problems with lazy initialization. When i clone the first object, i get not initialized collections cloned too, so i have to lock object to the session. I cannot lock it without dettaching first the cloned object.
Is there any way that my cloned object unitialized collections and proxys get a the session without dettaching the original and reattaching the cloned?

Thanks !!!


Top
 Profile  
 
 Post subject: nope
PostPosted: Sat Sep 03, 2005 12:53 am 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
It is not possible to have two objects of the same type with the same identifiers associated with the same hibernate session.

I would suggest to try updating state of the existing object from clone. That might be very convenient with BeanUtils from jakarta-commons.
http://jakarta.apache.org/commons/beanu ... ang.Object)

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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.