File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Hibernate Table per concrete class is throwing org.hibernate.NonUniqueObjectException: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate Table per concrete class is throwing org.hibernate.NonUniqueObjectException:" Watch "Hibernate Table per concrete class is throwing org.hibernate.NonUniqueObjectException:" New topic
Author

Hibernate Table per concrete class is throwing org.hibernate.NonUniqueObjectException:

VenkataPrasad Regula
Ranch Hand

Joined: Jun 30, 2011
Posts: 63
I have an abstract class and two concrete class which extend these abstract class. I have mapped all the three in a employee.hbm.xml file. It is throwing the following error. My db is mysql
Exception in thread "main" org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [temp.ContractEmployee#0]
.
Could someone kindly look into it.

Abstract Class


Extended Class 1

Extended Class 2


MainClass

employee.hbm.xml file



Arun Kumarr
Ranch Hand

Joined: May 16, 2005
Posts: 513

your primary key is "assigned"?
Where are you setting your primary key?


If you are not laughing at yourself, then you just didn't get the joke.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate Table per concrete class is throwing org.hibernate.NonUniqueObjectException: