0 Replies Latest reply on Jan 5, 2010 2:00 PM by nagarajan_ka

    Creating Process Instance with Sub-Process (jbpm4)

      Hey,

       

      I am trying to create a process instance with subprocess based on jbpm4 examples.

      I have attached JPDL for subprocess and process. I deployed subprocess first and then process.

       

      SubProcess - pickapprovers.jpdl.xml

      Process - interviewworkflow.jpdl.xml

       

       

      JUnit Code

       

        public void testSubProcessVariables() {

       

          ProcessInstance processInstance = executionService.startProcessInstanceByKey("InterviewWorkflowKey");

          assertNotNull(processInstance.findActiveExecutionIn("Pick Approvers Data element"));

       

        }

       

       

      But test case fails with the following error:

       

      10:33:59,437 [main] ERROR JDBCExceptionReporter : Violation of UNIQUE KEY constraint 'UQ__JBPM4_EXECUTION__33FF9E21'. Cannot insert duplicate key in object 'dbo.JBPM4_EXECUTION'.

      10:33:59,437 [main] ERROR AbstractFlushingEventListener : Could not synchronize database state with session

      org.hibernate.exception.ConstraintViolationException: could not insert: [org.jbpm.pvm.internal.model.ExecutionImpl]

      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)

      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)

      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2272)

      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2665)

      at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:60)

      at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)

      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)

      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)

      at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)

      at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)

      at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)

      at org.jbpm.pvm.internal.tx.HibernateSessionResource.prepare(HibernateSessionResource.java:56)

      at org.jbpm.pvm.internal.tx.StandardTransaction.commit(StandardTransaction.java:106)

      at org.jbpm.pvm.internal.tx.StandardTransaction.complete(StandardTransaction.java:65)

      at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:61)

      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)

      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)

      at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)

      at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)

      at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceByKey(ExecutionServiceImpl.java:66)

      at com.exterro.fusion.test.SubProcessTest.testSubProcessVariables(SubProcessTest.java:30)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

      at java.lang.reflect.Method.invoke(Unknown Source)

      at junit.framework.TestCase.runTest(TestCase.java:154)

      at org.jbpm.test.BaseJbpmTestCase.runTest(BaseJbpmTestCase.java:80)

      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.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)

      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

      Any pointers would help.