[
https://jira.jboss.org/jira/browse/JBPM-2333?page=com.atlassian.jira.plug...
]
steven wang updated JBPM-2333:
------------------------------
Attachment: ProcessEndTest.rar
The test case works when I use org.hibernate.dialect.HSQLDialect, but failed when I
switched to org.hibernate.dialect.MySQL5Dialect.
It seems MySQL can not delete a row when the row contains a foreign key reference to
itself.
08:10:44,890 FIN | [BaseJbpmTestCase] === starting testEndProcess
=============================
08:10:45,453 FIN | [BaseJbpmTestCase] using ProcessEngine 7295144
08:10:47,750 FIN | [ProcessDefinitionImpl] creating new execution for process
'vacation2'
08:10:47,750 FIN | [DefaultIdGenerator] generated execution id vacation2.7
08:10:47,765 FIN | [ExecuteActivity] executing activity(start1)
08:10:47,765 FIN | [ExecuteActivity] executing activity(request_vacation)
08:10:47,859 FIN | [Execution] process-instance ends
08:10:47,906 FIN | [DbSessionImpl] deleting process instance vacation2.7
[main] 08:10:47 ERROR (JDBCExceptionReporter.logExceptions:101) - Cannot delete or update
a parent row: a foreign key constraint fails (`avi`.`jbpm4_execution`, CONSTRAINT
`FK_EXEC_INSTANCE` FOREIGN KEY (`INSTANCE_`) REFERENCES `jbpm4_execution` (`DBID_`))
[main] 08:10:47 ERROR (AbstractFlushingEventListener.performExecutions:324) - Could not
synchronize database state with session
org.hibernate.exception.ConstraintViolationException: could not delete:
[org.jbpm.jpdl.internal.model.JpdlExecution#7]
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.svc.ExecutionServiceImpl.endProcessInstance(ExecutionServiceImpl.java:113)
at ProcessEndTest.testEndProcess(ProcessEndTest.java:37)
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:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at org.jbpm.test.BaseJbpmTestCase.runTest(BaseJbpmTestCase.java:81)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
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)
Failed to end ProcessInstance due to foreign key constraint
-----------------------------------------------------------
Key: JBPM-2333
URL:
https://jira.jboss.org/jira/browse/JBPM-2333
Project: JBoss jBPM
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Runtime Engine
Affects Versions: jBPM 4.0.CR1
Environment: MySQL 5.0.67-community-nt
Reporter: steven wang
Attachments: ProcessEndTest.rar
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_=?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira