• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting an error

 
Harjit Singh
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there,

I'm getting this error in hibernate

Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.my.nma.pojo .Lob#com.my.nma.pojo.LobId@bf82a59]

This message is a little bit cryptic. We found what the issue was. We had duplicate records for the same data and that was causing it. Is there some way to tell hibernate to spit out more information like some of the attibutes which are the key so that we can exactly tell what is it. Right now we had to take lot of hops to actually find what the issue was and connect the dot with the error.

Thanks

- Harjit
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately, Hibernate is not going to know the state of your database, whether you have bad duplicate data in there. It can only say hey, you are trying to attach a second object with the same Primary Key to an object I already have in the persistent state. (In first level cache)

Mark
 
Harjit Singh
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no data yet in the database its still in the Transient form about to be inserted in the the database. What I'm talking about is lets say you have a array of objects which has keys on a member and suppose you have 2 records having the same ID is there any way in hibernate to spit which records are duplicate...

Thanks

- Harjit
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic