AnsweredAssumed Answered

Unable to complete user task coming from parallel gateway

Question asked by mesterlis on Jan 11, 2012
Latest reply on Jan 12, 2012 by mesterlis

I came across an issue while completing simple user task from the parallel gateway. The detailed description is below.
Thank you in advance for the answer.

1. Create a TaskListener implementation that sets local variable on task creation
private Expression expression;

public void notify(DelegateTask delegateTask) {
   String expression = this.expression.getValue(delegateTask).toString();
   delegateTask.setVariableLocal("validationRule", expression);
2. In bpmn xml file, create a parallel gateway with 2 outgoing tasks: a simple user task and a user task with task listener
3. Deploy process definition
4. Run the process
5. Attempt to complete the simple user task programmatically
TaskService taskService = getProcessEngine().getTaskService();
6. Get the following stack trace:
### Error updating database.  Cause: java.sql.SQLException: The DELETE statement conflicted with the REFERENCE constraint "AC
T_FK_VAR_EXE". The conflict occurred in database "xxx", table "dbo.ACT_RU_VARIABLE", column 'EXECUTION_ID_'.
### The error may involve org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution-Inline
### The error occurred while setting parameters
### Cause: java.sql.SQLException: The DELETE statement conflicted with the REFERENCE constraint "ACT_FK_VAR_EXE". The conflic
t occurred in database "xxx", table "dbo.ACT_RU_VARIABLE", column 'EXECUTION_ID_'.
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(
        at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(
        at org.activiti.engine.impl.db.DbSqlSession$DeleteById.execute(
        at org.activiti.engine.impl.db.DbSqlSession.flushDeletes(
        at org.activiti.engine.impl.db.DbSqlSession.flush(
        at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(
        at org.activiti.engine.impl.interceptor.CommandContext.close(
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(
        at org.activiti.engine.impl.TaskServiceImpl.complete(