Announcement Announcement Module
Collapse
No announcement yet.
Error - Could not synchronize database state with session Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error - Could not synchronize database state with session

    Hello,
    When I try to update a column in a table, I get the error "Could not synchronize database state with session". Any idea what I am doing wrong ?
    Any help is much appreciated. Thanks!

    The code where I do the update is :

    public void updateFlag(List el) {
    Iterator it = el.iterator();
    Export_labor elData = null;
    while (it.hasNext()) {
    elData = (Export_labor) it.next();
    elData.setProcessed_In_Labor("1");
    getHibernateTemplate().update(elData);
    elData = null;
    }
    }


    The stack trace starts with :


    [2/16/06 9:18:29:130 CST] 00000032 SystemOut O Hibernate: select export_lab0_.BATCH_ID as BATCH_ID, export_lab0_.TIMESHEET_DT as TIMESHEE2_, export_lab0_.EMPL_ID as EMPL_ID, export_lab0_.TS_SCHEDULE_CD as TS_SCHED4_, export_lab0_.PERIOD_NO_CD as PERIOD_N5_, export_lab0_.LINE_NO as LINE_NO, export_lab0_.HRS_DT as HRS_DT, export_lab0_.UDT10_ID as UDT10_ID, export_lab0_.UDT01_ID as UDT01_ID, export_lab0_.UDT09_ID as UDT09_ID, export_lab0_.HRS as HRS, export_lab0_.LINE_DESC as LINE_DESC, export_lab0_.Processed_In_Labor as Process13_ from Export_Labor export_lab0_ where (export_lab0_.TIMESHEET_DT<=? )and(export_lab0_.Processed_In_Labor='0' )
    [2/16/06 9:18:31:005 CST] 00000032 SystemOut O Hibernate: update Export_Labor set UDT10_ID=?, UDT01_ID=?, UDT09_ID=?, HRS=?, LINE_DESC=?, Processed_In_Labor=? where BATCH_ID=? and TIMESHEET_DT=? and EMPL_ID=? and TS_SCHEDULE_CD=? and PERIOD_NO_CD=? and LINE_NO=? and HRS_DT=?
    [2/16/06 9:18:33:317 CST] 00000032 SessionImpl E net.sf.hibernate.impl.SessionImpl execute Could not synchronize database state with session
    net.sf.hibernate.HibernateException: SQL insert, update or delete failed (row not found)
    at net.sf.hibernate.impl.NonBatchingBatcher.addToBatc h(NonBatchingBatcher.java:25)
    at net.sf.hibernate.persister.EntityPersister.update( EntityPersister.java:687)
    at net.sf.hibernate.persister.EntityPersister.update( EntityPersister.java:640)
    at net.sf.hibernate.impl.ScheduledUpdate.execute(Sche duledUpdate.java:52)

  • #2
    where BATCH_ID=? and TIMESHEET_DT=? and EMPL_ID=? and TS_SCHEDULE_CD=? and PERIOD_NO_CD=? and LINE_NO=? and HRS_DT=?
    Few questions:
    - what is the primary key of the table?
    - Did you define the hibernate id properly?
    - Did you try using saveOrUpdate()?

    Comment


    • #3
      Thanks for your reply. I already figured out the problem. It was with one of my getters. And thus hibernate was not able to find the record for updating.

      Comment

      Working...
      X