AnsweredAssumed Answered

Unable to complete parallel task (foreign key violation)

Question asked by risto45 on Aug 24, 2012
Latest reply on Sep 5, 2012 by roig
I have a problem that seems like a bug, but I'm not sure - maybe I'm doing something wrong.

I have two parallel tasks. During the execution some variables are added to the tasks using
taskService.setVariableLocal(taskId, variable, value). And now when I call taskService.complete(taskId)
on one of the tasks, I get the following error:

org.apache.ibatis.exceptions.PersistenceException: ### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: update or delete on table "act_ru_execution" violates foreign key constraint "act_fk_var_exe" on table "act_ru_variable" Detail: Key (id_)=(17126) is still referenced from table "act_ru_variable". ### The error may involve org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution-Inline ### The error occurred while setting parameters ### SQL: delete from ACT_RU_EXECUTION where ID_ = ? ### Cause: org.postgresql.util.PSQLException: ERROR: update or delete on table "act_ru_execution" violates foreign key constraint "act_fk_var_exe" on table "act_ru_variable" Detail: Key (id_)=(17126) is still referenced from table "act_ru_variable".

Table act_ru_variable has a FOREIGN_KEY that references to act_ru_execution (id_).
And it seems that when I set the task to be complete(), then Activity tries to delete the execution from act_ru_execution before it deletes the task variables from act_ru_variables.

Is this a bug? Or has anyone ideas how to solve this.
Can I remove the foreign key - or does it mess up other things?

Many thanks,
Risto

Outcomes