AnsweredAssumed Answered

Constraint violation when completing user task with timer

Question asked by capacia on Feb 8, 2012
Latest reply on Feb 8, 2012 by capacia
I have a main process calling another process multiple times using CallActivity with MultiInstance (sequentially).
The called process has (after other tasks) a User Task with a Boundary Timer (see attached image).

In my unit tests I have 2 unit tests doing exactly the same:
The main process calls the other process 5 times.
Each user task is assigned to a user and completed, so that it is going the succeeded path afterwards.

The first test is executed successfully.
The second test throws the following exception, when completing the user task of the first CallActivity:


org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: "ACT_FK_EXE_PROCINST: PUBLIC.ACT_RU_EXECUTION FOREIGN KEY(PROC_INST_ID_) REFERENCES PUBLIC.ACT_RU_EXECUTION(ID_)"; SQL statement:
delete from ACT_RU_EXECUTION where ID_ = ? [23003-132]
### The error may involve org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution-Inline
### The error occurred while setting parameters
### Cause: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: "ACT_FK_EXE_PROCINST: PUBLIC.ACT_RU_EXECUTION FOREIGN KEY(PROC_INST_ID_) REFERENCES PUBLIC.ACT_RU_EXECUTION(ID_)"; SQL statement:
delete from ACT_RU_EXECUTION where ID_ = ? [23003-132]
   at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:120)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:131)
   at org.activiti.engine.impl.db.DbSqlSession$DeleteById.execute(DbSqlSession.java:146)
   at org.activiti.engine.impl.db.DbSqlSession.flushDeletes(DbSqlSession.java:444)
   at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:349)
   at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:147)
   at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:103)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:49)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:144)
       …
Caused by: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: "ACT_FK_EXE_PROCINST: PUBLIC.ACT_RU_EXECUTION FOREIGN KEY(PROC_INST_ID_) REFERENCES PUBLIC.ACT_RU_EXECUTION(ID_)"; SQL statement:
delete from ACT_RU_EXECUTION where ID_ = ? [23003-132]
   at org.h2.message.DbException.getJdbcSQLException(DbException.java:316)
   at org.h2.message.DbException.get(DbException.java:167)
   at org.h2.message.DbException.get(DbException.java:144)
   at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:374)
   at org.h2.constraint.ConstraintReferential.checkRowRefTable(ConstraintReferential.java:391)
   at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:271)
   at org.h2.table.Table.fireConstraints(Table.java:766)
   at org.h2.table.Table.fireAfterRow(Table.java:783)
   at org.h2.command.dml.Delete.update(Delete.java:79)
   at org.h2.command.CommandContainer.update(CommandContainer.java:70)
   at org.h2.command.Command.executeUpdate(Command.java:198)
   at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:179)
   at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:22)
   at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:51)
   at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:29)
   at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:75)
   at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:43)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:118)
   … 48 more

If I remove the BoundaryTimer, then everything works correctly.
Do you have any idea what's going wrong here?

Attachments

Outcomes