3 Replies Latest reply on Jun 16, 2009 11:26 AM by Flavio Donzé

    Subprocess followed by

    Flavio Donzé Newbie

      Hello everyone

      I want my main process to end if the subprocess returns a certain result. If the subprocess is followed by an "end" element the following Exception is thrown:

      ### EXCEPTION ###########################################
      14:44:51,812 SEV | [AbstractFlushingEventListener] Could not synchronize database state with session
      org.hibernate.exception.ConstraintViolationException: could not delete: [org.jbpm.jpdl.internal.model.JpdlExecution#6]
       at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
       at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
       at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2569)
       at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2725)
       at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:97)
       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:172)
       at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
       at org.jbpm.pvm.internal.tx.HibernateSessionResource.prepare(HibernateSessionResource.java:54)
       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.execute(EnvironmentInterceptor.java:54)
       at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
       at org.jbpm.pvm.internal.repository.RepositoryServiceImpl.deleteDeploymentCascade(RepositoryServiceImpl.java:62)
       at org.jbpm.examples.subprocess.outcomeactivity.SubProcessOutcomeActivityTest.tearDown(SubProcessOutcomeActivityTest.java:52)
       at junit.framework.TestCase.runBare(TestCase.java:130)
       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:460)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      Caused by: java.sql.SQLException: Integrity constraint violation FK_EXEC_SUBPI table: JBPM4_EXECUTION in statement [delete from JBPM4_EXECUTION where DBID_=? and DBVERSION_=?]
       at org.hsqldb.jdbc.Util.throwError(Unknown Source)
       at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
       at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2551)
       ... 29 more
      


      You can test this using the org.jbpm.examples.subprocess.outcomeactivity test case.
      Change the following:

      <process name="SubProcessDocument" xmlns="http://jbpm.org/4.0/jpdl">
      
       <start g="32,111,48,48">
       <transition to="review" />
       </start>
      
       <sub-process name="review"
       sub-process-key="SubProcessReview"
       g="96,16,127,52">
      
       <transition name="ok" to="next step" g="167,67:6,-19"/>
       <transition name="nok" to="update" g="-22,-18"/>
       <transition name="reject" to="close" g="167,200:7,3"/>
       </sub-process>
      
       <state name="next step" g="255,41,88,52"/>
       <state name="update" g="256,106,88,52"/>
       <end name="close" g="258,175,88,52"/>
      
      </process>
      


      The last element is changed from a "state" to an "end" element.

      Well is this constellation conceptional not possible or should I file a bug?

      cheers
      Flavio