This week's book giveaway is in the Java in General forum. We're giving away four copies of 97 Things Every Java Programmer Should Know and have Kevlin Henney & Trisha Gee on-line! See this thread for details.
I got a strange error. The message given to me is as follows.
Data Access Failure
More than one row with the given identifier was found: 1, for class: com.trailsindia.innform.model.TransactionDetails; nested exception is org.hibernate.HibernateException: More than one row with the given identifier was found: 1, for class: com.trailsindia.innform.model.TransactionDetails
The server displays as follows....
[clubone] WARN [btpool0-1] LoadContexts.cleanup(108) | fail-safe cleanup (collections) : org.hibernate.engine.loading.CollectionLoadContext@1dd5c52<rs=org.apache.commons.dbcp.DelegatingResultSet@6edb>
[clubone] WARN [btpool0-1] CollectionLoadContext.cleanup(332) | On CollectionLoadContext#cleanup, localLoadingCollectionKeys contained  entries
Well, the error is pretty self-explanatory - Hibernate sees two different rows or record with the same primary key. How that error happened can be tricky.
How has your table defined the primary key in the XML file? Is it a compound key? Often a compound or surrogate key defined in the xml or annotation, that is not backed up or constrained at the database level, will trigger this type of exception.
This happens only on selects? Nobody is creating any rows during this operation while manually creating a primary key for the record in their code?
posted 11 years ago
Thanks to Cameron McKenzie,
I just found the error. It is due to wrong mapping relationship (OneTo one) It must be (OneToMany or ManyToOne) relationship.