Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Update in hibernate  RSS feed

Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am getting the following exception when i try to update a record.

org.hibernate.HibernateException: identifier of an instance of Honey altered from 10 to 0
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(
at org.hibernate.impl.SessionImpl.flush(
at org.hibernate.impl.SessionImpl.managedFlush(
at org.hibernate.transaction.JDBCTransaction.commit(
at grtr.main(

the code which i using to update is as follows

Honey message =(Honey) session.load( Honey.class, new Integer(10) );
message.setFirstname("Greetings Earthling");

Any help will be very much appreciated .
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!