For our business case we have to lock some business object when it is participant in Activiti process.
We inserted some lock record in a process_lock table when we starts the process, and use a trigger on ACT_HI_PROCINST_ table to detect the process end and delete those lock record.
It works fine for most cases until one day we have a process execution path only have service nodes.
The process start invocation will have all those service tasks in the execution path in one transaction that works, but the start process invocation doesn't returns. And we find that the trigger is activated in another transaction, not the one which we started the process and applied the process lock.
When we applied the process lock, we get the table lock on the process_lock table which prevent another transaction to delete from the table thus caused dead lock.
I am wondering why a new transaction is used here?