-->
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: Object with same identifier problem
PostPosted: Thu Jul 07, 2005 10:57 am 
I am facing the following error:

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

I have the following scenario:
I have a object A1 of type ClassA which contains 2 objects:

1) B1 of type ClassB
2) A2 of type ClassA again

Now A2 contains the same instance B1 in it also.

So whenever i invoke saveOrUpdate method for A1, i get the exception saying B1 is already associated with the session.

How do i save this object graph?

Thank you.


Top
  
 
 Post subject:
PostPosted: Fri Jul 08, 2005 9:49 am 
Is there no way through which i can have same object present in a single session?

I tried out creating a new Session in the onUpdate method and saving the object(which was giving the NonUniqueObjectException) through this new session. It worked.

However, is this the right thing to do. i.e. opening a new session inside callback methods?


Top
  
 
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.