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


Win a copy of Java 8 in Action this week in the Java 8 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Hibernate Table per concrete class is throwing org.hibernate.NonUniqueObjectException:
 
Similar Threads
Can't able to insert row in table per concrete class strategy .
problem in parsing mapping document.
Constructor Problem
How to persist objects having circular references using Hibernate
Different Mapping Types in Hibernate