Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Error: Data Access Failure

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

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 [2] entries

The transactionDetails table is shown below....

mysql> select * from transaction_details;
+----+-----------+----------+----------------+-------------+--------+-------------+-------------------+--------------------+----------+--------------------+-----------+
| id | cv_number | cv_value | expired_points | expiry_date | points | earned_date | redumption_points | trans_remarks | hotel_id | points_earned_type | member_id |
+----+-----------+----------+----------------+-------------+--------+-------------+-------------------+--------------------+----------+--------------------+-----------+
| 1 | NULL | NULL | 0 | 2012-03-02 | 100 | 2009-03-02 | 0 | Enrollement Points | 1 | 1 | 1 |
| 2 | NULL | NULL | 0 | 2012-03-02 | 100 | 2009-03-02 | 0 | Enrollement Points | 1 | 1 | 2 |
+----+-----------+----------+----------------+-------------+--------+-------------+-------------------+--------------------+----------+--------------------+-----------+
2 rows in set (0.00 sec)


Does anyone Knows what error I have got???

Thanks in advance.

Philip
 
author and cow tipper
Posts: 5000
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

-Cameron McKenzie


 
Philip Zac
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Anyway, thanks.

Philip
 
Cameron Wallace McKenzie
author and cow tipper
Posts: 5000
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sometimes the most obvious of errors are the hardest to spot. I'm glad the problem is solved and it's finally working.

Happy Hibernating!

-Cameron McKenzie
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I googled for that error/warning, so I got here. Mine was more obvious, instead of

it should be

thanks for this post
 
    Bookmark Topic Watch Topic
  • New Topic