• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

PROBLEM WITH ONE-TO-MANY RELATION

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am getting below exception : it is a simple ans straight one=to-many relation ship

org.hibernate.HibernateException: identifier of an instance of fleetcycle.domain.mxReporting.MxReportDefinitionAta was altered from 8a9e82a423e259da0123e25ae4570003 to null



Pleasse help me out whay i am getting this exception???
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Based on "was altered from 8a9e82a423e259da0123e25ae4570003 to null "

It looks like in your code you have an object which you are changing the ID field. Hibernate uses the id as the way to identify an object to a row in the database, and is usually the PK of your table, so if you changed the pk value, it would fail to find the corresponding row in the database. Hibernate also uses the id field to determine whether it needs to do an insert or an update statement.

Usually the id field is set as private without a setter method.

Mark
 
Lavanya Rao
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, you are correct.


but i am no where doing any manipulation to the Id

i have same sort of relation's for the User domain , all are working fine, except this :-(


plese do some thing..... :-)
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic