AnsweredAssumed Answered

Activiti process variable version and Optimistic Locking Exception

Question asked by silverhoof1 on Jan 27, 2014
Latest reply on Jul 2, 2014 by hrobayo
I totally understand to avoid multiple thread concurrently access the same variable is necessary.
But in my case, I found some weird behavior of the optimistic locking system.
I found that when I have a program issue an Task Query like this:

The process engine automatically updated the ver_ column in ACT_GE_BYTEARRAY table. If two people query the same task at the same time, one of them get following exception:
org.activiti.engine.ActivitiOptimisticLockingException: ByteArrayEntity[id=16067, name=xxxx, size=834361] was updated by another transaction concurrently

The problem is, I never intended to update the variables. The use case is just show more task information in our customized task list using process variables and a template. Why upgrade version when reading variables from process instance? I assumed the correct behavior is doing this during the write time when I set variables back to the process instance.