1 Reply Latest reply on Feb 19, 2006 3:59 PM by Alejandro Guizar

    JbpmPersistenceException: couldn't commit hibernate session

    shriram e Newbie

      Hi,

      I am trying to create a task and task instance at runtime, but always get the following error :

      Here is my Code :

      public class Node1EnterActionHandler implements ActionHandler {

      public void execute(ExecutionContext executionContext) throws Exception {
      // TODO Auto-generated method stub

      System.out.println( "entered in Node1EnterActionHandler");
      System.out.println( "exitting in Node1EnterActionHandler");

      Token token = executionContext.getToken();
      TaskMgmtInstance taskMgmt = executionContext.getTaskMgmtInstance();
      Task newTask = new Task("RuntimeTask");
      TaskInstance taskInstance = taskMgmt.createTaskInstance(newTask,token);
      taskInstance.setName("RuntimeTaskIns");
      taskInstance.setActorId("Shriram");

      }

      }

      Iam not sure whether iam making any mistake.
      If so plz giude me.....


      Exception is : >>>>>>>>>
      15:35:53,156 [main] DEBUG DbPersistenceService : committing hibernate transaction
      org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:171)
      at org.jbpm.svc.Services.close(Services.java:211)
      at org.jbpm.JbpmContext.close(JbpmContext.java:138)
      at com.demo.Main.NodeTypesMain.startProcessExecution(NodeTypesMain.java:83)
      at com.demo.Main.NodeTypesMain.main(NodeTypesMain.java:96)
      Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.jbpm.taskmgmt.def.Task at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:216)
      at org.hibernate.type.EntityType.getIdentifier(EntityType.java:108)
      at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:221)
      at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:476)
      at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:2803)
      at org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:467)
      at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:190)
      at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:113)
      at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
      at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
      at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
      at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:980)
      at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:353)
      at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:161)
      ... 4 more
      15:35:53,203 [main] ERROR Services : problem closing service 'persistence'
      org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:171)
      at org.jbpm.svc.Services.close(Services.java:211)
      at org.jbpm.JbpmContext.close(JbpmContext.java:138)
      at com.demo.Main.NodeTypesMain.startProcessExecution(NodeTypesMain.java:83)
      at com.demo.Main.NodeTypesMain.main(NodeTypesMain.java:96)
      Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.jbpm.taskmgmt.def.Task
      at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:216)
      at org.hibernate.type.EntityType.getIdentifier(EntityType.java:108)
      at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:221)
      at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:476)
      at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:2803)
      at org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:467)
      at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:190)
      at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:113)
      at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
      at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
      at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
      at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:980)
      at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:353)
      at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:161)
      ... 4 more
      15:35:53,203 [main] DEBUG Services : closing service 'logging': org.jbpm.logging.db.DbLoggingService@d0a6a3
      org.jbpm.JbpmException: problem closing services {persistence=org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session}
      at org.jbpm.svc.Services.close(Services.java:223)
      at org.jbpm.JbpmContext.close(JbpmContext.java:138)
      at com.demo.Main.NodeTypesMain.startProcessExecution(NodeTypesMain.java:83)
      at com.demo.Main.NodeTypesMain.main(NodeTypesMain.java:96)
      Caused by: org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:171)
      at org.jbpm.svc.Services.close(Services.java:211)
      ... 3 more
      Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.jbpm.taskmgmt.def.Task
      at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:216)
      at org.hibernate.type.EntityType.getIdentifier(EntityType.java:108)
      at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:221)
      at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:476)
      at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:2803)
      at org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:467)
      at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:190)
      at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:113)
      at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
      at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
      at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
      at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:980)
      at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:353)
      at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:161)
      ... 4 more
      Exception in thread "main"


      Thanks in Advance for any repliesShriram