0 Replies Latest reply on Oct 17, 2007 7:03 AM by Deepika Rashmi

    Updating Timer

    Deepika Rashmi Newbie

      Hi All,

      I have a requirement according to which I need to add one more column to the JBPM_TIMER table and update that value before executing the Timer.

      I have updated the Timer.hbm.xml and Timer.java accordingly after making changes in the database.

      Below is the JUnit test which I am using to update the Timer object. However, I am getting an AssertionFailure.

      public void testUpdateThreadStatus() throws Exception
       JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
       JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
       SchedulerSession schedulerSession = null;
       Session session = null;
       Timer timer = null;
       Long timerId = new Long(3919710);
       session = jbpmContext.getSession();
       schedulerSession = jbpmContext.getSchedulerSession();
       timer = (Timer)session.load(Timer.class, timerId);
       System.out.println("Timer object retrieved from Database : " + timer.getName());
       if(timer.getThreadStatus() == 0)
       System.out.println("Going to update the THREADSTATUS_ column for the Timer " + timer.getId());
       if(jbpmContext != null)

      The error which I get is as given below:

      DEBUG> org.hibernate.event.def.AbstractFlushingEventListener[main]: post flush
      ERROR> org.hibernate.AssertionFailure[main]: an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
      org.hibernate.AssertionFailure: collection [org.jbpm.graph.def.Node.leavingTransitions] was not processed by flush()
      at org.hibernate.engine.CollectionEntry.postFlush(CollectionEntry.java:205)
      at org.hibernate.event.def.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:332)
      at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:28)
      at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
      at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
      at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:161)
      at org.jbpm.svc.Services.close(Services.java:211)
      at org.jbpm.JbpmContext.close(JbpmContext.java:138)
      at com.ssc.faw.idf.junit.bpm.UpdateThreadStatusForSchedulerThread.testUpdateThreadStatus(UpdateThreadStatusForSchedulerThread.java:72)

      My requirement is only to update the Timer object before actually executing the Timer.

      Any help in this regard will be very useful for me.

      Thanks in advance.