aspose 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
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Hibernate Table per concrete class is throwing org.hibernate.NonUniqueObjectException: