-->
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.  [ 1 post ] 
Author Message
 Post subject: Session.lock() creates duplicate proxies
PostPosted: Thu Sep 03, 2009 10:50 pm 
Newbie

Joined: Thu Sep 03, 2009 10:24 pm
Posts: 1
Hi

I do a Session.lock() on a collection of detached objects to attach them to the current session.
The objects have a many-to-one association chain of objects with cascade="lock".
Upon Session.lock() I get a

org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session

It seems that Hibernate creates different proxies for the same object.

I wonder if that's the expected behaviour or whether there is something going wrong.

As a work-around I pre-initialize the object and the proxy chain with Session.initialize().
Re-attaching the object to the current session through Session.lock() then seems to work.

Any thoughts?

Cheers,

Felix


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.