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: Proxy and MemberwiseClone
PostPosted: Tue Sep 18, 2007 2:21 pm 
Newbie

Joined: Wed Apr 07, 2004 6:13 pm
Posts: 18
Hi,

Version: 1.2.0.GA
.NET: 2.0

I am attempting to do a deep clone of my domain object by initially doing a "MemberwiseClone" and then adjusting the properties / relationships per my business rules.

This was working great for the first day... but now I am getting data integrity errors due to NHibernate viewing the newly cloned object as "already associated with a session". This happens on the "Save" call when NHibernate does a "GetEntry" on the IdentityMap in SessionImpl. From what I understand, this will perform an "==" operation, so I am not sure how this "cloned" object can reference another object in memory.

Also, I believe that this became a problem when the object I am cloning was a NHibernate Proxy, rather than the underlying implementation.

Thanks in advance,
Aaron

_________________
Thanks,
Aaron


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 18, 2007 2:47 pm 
Newbie

Joined: Wed Apr 07, 2004 6:13 pm
Posts: 18
An update on this: appears to be an issue only if the proxy is uninitialized. I changed my code to do a "Get" rather than a "Load" and it works again. Makes sense.

_________________
Thanks,
Aaron


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.