• 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
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Hibernate Issue: More than one row with the given identifier

 
Greenhorn
Posts: 16
  • 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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!