cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to complete user task coming from parallel gateway

mesterlis
Champ in-the-making
Champ in-the-making
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)
3 REPLIES 3

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Does te process end immediately after te gateway?

mesterlis
Champ in-the-making
Champ in-the-making
Hi Ronald,
The user task that flows from the parallel gateway completes the process.
I am attaching an example of process definition.
Thank you,
Marina

<?xml version="1.0" encoding="UTF-8" ?>
<definitions id="definitions" targetNamespace="http://activiti.org/bpmn20"
xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="http://www.omg.org/spec/DD/20100524/DI"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">

<process id="ForkProcessDef" name="Fork Process Def">
 
  <startEvent id="theStart" />

  <sequenceFlow id="theStart_InitialFork" sourceRef="theStart" targetRef="InitialFork" />
 
  <parallelGateway id="InitialFork" />
  <sequenceFlow id="InitialFork_SimpleUser" sourceRef="InitialFork" targetRef="SimpleUser" />
  <sequenceFlow id="InitialFork_UserwithListener" sourceRef="InitialFork" targetRef="UserwithListener" />
 
  <userTask id="SimpleUser" name="Simple User" activiti:formKey="someform" activiti:assignee="someuser"></userTask>
 
  <sequenceFlow id="SimpleUser_theEnd" sourceRef="SimpleUser" targetRef="theEnd" />
 
  <userTask id="UserwithListener" name="User with Listener" activiti:formKey="someform" activiti:assignee="someuser">
   <extensionElements>
    <activiti:taskListener event='create' class='com.myorg.workflow.servicetask.CreateTaskListener'>
     <activiti:field name='expression' stringValue='some expression value' />
    </activiti:taskListener>
   </extensionElements>
  </userTask>
 
  <sequenceFlow id="UserwithListener_theEnd" sourceRef="UserwithListener" targetRef="theEnd" />
 
  <endEvent id="theEnd" />
</process>
</definitions>

mesterlis
Champ in-the-making
Champ in-the-making