4 Replies Latest reply on Sep 26, 2006 9:04 AM by Dave Caruana

    unable to delete process instance

    edgar poce Newbie

      Hi
      I'm trying to delete an ended process instance and I get a weird exception. Any help is appreciated.

      br,
      edgar

      java.lang.RuntimeException: couldn't delete process instance '1'
      at org.jbpm.db.GraphSession.deleteProcessInstance(GraphSession.java:315)
      at ar.com.sibs.sca.liquidacion.impl.PreliquidacionTest.testAnular(PreliquidacionTest.java:38)
      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.exception.ConstraintViolationException: could not execute update query
      at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:74)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
      at org.hibernate.hql.ast.UpdateStatementExecutor.execute(UpdateStatementExecutor.java:99)
      at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:297)
      at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:871)
      at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:89)
      at org.jbpm.db.GraphSession.deleteProcessInstance(GraphSession.java:307)
      ... 16 more
      Caused by: java.sql.SQLException: Integrity constraint violation FK_LOG_PARENT table: JBPM_LOG in statement [delete from JBPM_LOG where TOKEN_ in (?)]
      at org.hsqldb.jdbc.Util.throwError(Unknown Source)
      at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
      at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:104)
      at org.hibernate.hql.ast.UpdateStatementExecutor.execute(UpdateStatementExecutor.java:76)
      ... 20 more

        • 1. Re: unable to delete process instance
          edgar poce Newbie

          hi

          I tried to dig the cause of this problem, and it seems the deletion of variable instances is not working correctly.

          My problem is that if I don't remove the variable instances, when I try to remove the process instance I get an exception that complaints about the referential integrity, specifically about the constraint FK_VARINST_TKVARMP, in the table "JBPM_VARIABLEINSTANCE".

          The curious thing is that when I delete all the variable instances, the process instance can be deleted without problems, but in "JBPM_VARIABLEINSTANCE" remains a variable instance without any value in the "TOKEN_" field. As a workaround I can delete the variable instances in my code, and then delete the process instance itself.

          I'm a newbie with JBPM, so if I'm missing something important I would really appreciate any help.

          br,
          edgar

          • 2. Re: unable to delete process instance
            Dave Caruana Newbie

            JBPM 3.1.2

            With 3.1.2, I get similar constraint violations from FK_VARINST_TKVARMP, in the table "JBPM_VARIABLEINSTANCE".

            I too manually delete variable instances before deleting the process instance, but I still have cases where this does not work resulting in the above constraint violation. I'm attempting to find a simple reproducible test case, but don't have one yet.

            Anyone have any reliable code for deleting a process instance? Thanks.

            Should I raise a bug in JIRA?

            • 3. Re: unable to delete process instance
              Tom Baeyens Master

              yes. please create a jira issue for this. preferrably with instructions or a code snippet on how to reproduce the problem. that will help in getting it resolved quickly.

              • 4. Re: unable to delete process instance
                Dave Caruana Newbie

                Hi Tom,

                It's taken a while to get to a concise reproducible case!

                I've raised http://jira.jboss.com/jira/browse/JBPM-757 which provides a description of the issue and concise test case.

                Thanks,
                David Caruana
                Alfresco