Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Hibernate Issue: More than one row with the given identifier

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have two tables

Employee Table
Address Table

Employee Table hbm definition will have the following



Address Table hbm definition will have the following




Currently the application throws the following exception when execute the following HQL query

from Address where primarykey = '1232';

More than one row with the given identifier was found: 1232, for class:
com.region.Employee (compact stack trace follows)
org.hibernate.loader.entity.AbstractEntityLoader.load
(AbstractEntityLoader.java:92)

Clarification

1. Will Address primary key will always have one similar primary key in  Employee?
2. Will the Address primary key might differs from Employee primary key column
3. Will the Address primary key will always have one similar address column value in Employee table?
4. When this issue might come?
5. How to fix the problem

Please refer hibernate in action page number 221. Many to one is really a one-to-one. We have defined so that it works properly. please go through the PDF 221 for more info - cpe.ku.ac.th/~plw/oop/e_book/hibernate_in_action.pdf

Regards.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure your database definition is in line with the Hibernate configuration?
That is, there are no two records with given id?
 
This tiny ad is wafer thin:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!