-->
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.  [ 5 posts ] 
Author Message
 Post subject: Different object with same identifier problem.
PostPosted: Fri May 20, 2005 12:14 pm 
Newbie

Joined: Fri May 20, 2005 12:02 pm
Posts: 10
Thanks for reading everyone.

Hibernate version: 3.0.3

Full stack trace of any exception that occurs:
org.springframework.orm.hibernate3.HibernateSystemException: a different object with the same identifier value was already associated with the session: [com.objects.Department#1]; nested exception is org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.objects.Department#1]

Name and version of the database you are using: Oracle 9.2.0.4

I'm using Spring 1.2 RC2 with Hibernate 3.0.3. Does the above exception typically denote a flaw in the data itself or something to do with my relationships? I'm trying to save a Group object that contains Persons and other Groups as members. Each Person member has a Department that is cascaded, but not presented to the user when saving a Group. Should anything obvious jump out at me with this error?

Many thanks everyone,
Dustin


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 4:43 pm 
Newbie

Joined: Fri May 20, 2005 4:16 pm
Posts: 13
Just a quick guess, but are you implementing equals()/hashCode() in the collection childs by any chance?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 4:48 pm 
Newbie

Joined: Fri May 20, 2005 12:02 pm
Posts: 10
As a matter of fact I am, for most of the objects anyway. Some of the field members don't have an equals()/hashCode() method. The equals() method compares the ID usually, but sometimes it's the names that get compared. Do you think that's the problem?

Thanks for the reply,
Dustin


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 4:56 pm 
Newbie

Joined: Fri May 20, 2005 4:16 pm
Posts: 13
Yes, it most probably is.

http://www.hibernate.org/109.html


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 4:59 pm 
Newbie

Joined: Fri May 20, 2005 12:02 pm
Posts: 10
Excellent, thank you very much.

Dustin


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.