0 Replies Latest reply on Aug 25, 2005 12:04 PM by mike groezinger

    Problem using RuntimeAction

    mike groezinger Newbie

      Hello,

      I want to create a RunTimeAction within an action handler and run into problems.

      The ActionHandler that creates the RunTimeAction:

       public void execute(ExecutionContext ctx) throws Exception {
       ActionHandler unregisterDelegation = new UnRegistrationHandler(this);
      
       Action action = new Action(new Delegation(unregisterDelegation));
       RuntimeAction runTimeAction = new RuntimeAction(new Event(ctx.getNode(), Event.EVENTTYPE_NODE_LEAVE), action);
      
       ctx.getProcessInstance().addRuntimeAction(runTimeAction);
       tokenId = ctx.getToken().getId();
       TriggerEventManager.instance.register(this);
       }
      


      The client code looks like this:
      
       token.signal();
       assertEquals("datawait", token.getNode().getName());
       long pid = processInstance.getId();
      
       jbpmSession.getGraphSession().saveProcessInstance(processInstance);
       jbpmSession.commitTransactionAndClose();
      
      
      



      The following error occures when comitting the transaction
      org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.jbpm.graph.def.Action
      
      


      Stack trace:
      java.lang.RuntimeException: couldn't commit transaction
       at org.jbpm.db.JbpmSession.commitTransaction(JbpmSession.java:107)
       at org.jbpm.db.JbpmSession.commitTransactionAndClose(JbpmSession.java:129)
       at drm.TriggerTest.testTriggerEvent(TriggerTest.java:122)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at junit.framework.TestCase.runTest(TestCase.java:154)
       at junit.framework.TestCase.runBare(TestCase.java:127)
       at junit.framework.TestResult$1.protect(TestResult.java:106)
       at junit.framework.TestResult.runProtected(TestResult.java:124)
       at junit.framework.TestResult.run(TestResult.java:109)
       at junit.framework.TestCase.run(TestCase.java:118)
       at junit.framework.TestSuite.runTest(TestSuite.java:208)
       at junit.framework.TestSuite.run(TestSuite.java:203)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.jbpm.graph.def.Action
       at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:216)
       at org.hibernate.type.EntityType.getIdentifier(EntityType.java:99)
       at org.hibernate.type.EntityType.isDirty(EntityType.java:216)
       at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:412)
       at org.hibernate.persister.entity.BasicEntityPersister.findDirty(BasicEntityPersister.java:2538)
       at org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:344)
       at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:108)
       at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:190)
       at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:70)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
       at org.jbpm.db.JbpmSession.commitTransaction(JbpmSession.java:102)
       ... 17 more
      
      
      


      Any ideas? Has anybody used creation of RunTimeActions successfully?

      Mike