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
Hello,

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();
taskService.complete(taskId);
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(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)

Outcomes