-->
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: Bug? Reattaching Entity Fails Using SaveOrUpdate in beta3
PostPosted: Fri Jan 12, 2007 2:10 pm 
Senior
Senior

Joined: Mon Aug 21, 2006 9:18 am
Posts: 179
Hi,
I am using the NHib 1.2 beta 3.

I was trying to reassociate a entity using SaveOrUpdate(object) according to this post
http://forum.hibernate.org/viewtopic.php?t=966381&highlight=lock+update+reattach

and I kept getting the dreaded NonUniqueObjectException stating one of the CHILD objects was already in the ISession. I ran some checks to make sure just before I reattached it that the object (and its children) weren't associated and all was good. Turns out that in the SaveOrUpdate call there is a call to DoUpdateMutable() in SessionImp that checks for uniqueness AFTER it has already performed the Update...which means that reattaching will fail obviously.

I did the reattachment using Lock() and then Update() and both of those worked just fine. Is this a bug or by design?
The post that includes Sergey's post (above) indicates that SaveOrUpdate is a valid way to reattach a nontransient instance to a Session.

MIKE

_________________
If this helped...please remember to rate it!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 15, 2007 2:46 pm 
Senior
Senior

Joined: Mon Aug 21, 2006 9:18 am
Posts: 179
Has anyone else had joy with using SaveOrUpdate to reattach an entity to an ISession?

_________________
If this helped...please remember to rate it!


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.