• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PROBLEM WITH ONE-TO-MANY RELATION

 
Lavanya Rao
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • 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???
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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..... :-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic