Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-2333

Failed to end ProcessInstance due to foreign key constraint

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • jBPM 4.0.CR1
    • jBPM 4.0.CR1
    • Runtime Engine
    • None

      When I try to end a process instance with DBID_ = 9, an exception as flows is thrown:

      Hibernate:
      /* delete org.jbpm.jpdl.internal.model.JpdlExecution */ delete
      from
      JBPM4_EXECUTION
      where
      DBID_=?
      and DBVERSION_=?
      [http-8080-Processor25] 19:24:49 ERROR (JDBCExceptionReporter.logExceptions:101) - Cannot delete or update a parent row: a foreign key constraint fails (`jbpm4_execution`, CONSTRAINT `FK_EXEC_INSTANCE` FOREIGN KEY (`INSTANCE_`) REFERENCES `jbpm4_execution` (`DBID_`))
      [http-8080-Processor25] 19:24:49 ERROR (AbstractFlushingEventListener.performExecutions:324) - Could not synchronize database state with session
      org.hibernate.exception.ConstraintViolationException: could not delete: org.jbpm.jpdl.internal.model.JpdlExecution#9
      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.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:79)
      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.svc.ExecutionServiceImpl.endProcessInstance(ExecutionServiceImpl.java:113)
      ...

      The row to be deleted in table jbpm4_execution has data:

      9, 'jpdl', 1, 'request_vacation', 'vacation2-1', b, '', '', 'vacation2.9', 'active-root', '', 0, 4, , 9, , ,

      It seems column PROCESS_ has value 9 which self references current row with foreign key K_EXEC_INSTANCE.

      but MySQL can not delete this row with SQL:
      /* delete org.jbpm.jpdl.internal.model.JpdlExecution */ delete
      from
      JBPM4_EXECUTION
      where
      DBID_=?
      and DBVERSION_=?

              Unassigned Unassigned
              xml2008 steven wang (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: