When I started the process, the ACT_HI_VARINST table recorded a row where the Name column value was row2Field and the TEXT column value was aaa, with REV_=0.
In the next node, a userTask, there were two approvers, A and B. They all use taskService.complete(task.getId(), variables, true); to do task.After approver A complete task, , the table is inserted one new row row2Field with value aaa-1 with its taskId. At this point, the initial row (row2Field = aaa ) is deleted.
Subsequently, After approver B complete task, the table is inserted one new row row2Field with value aaa-2 with its taskId.
I believe the correct behavior should be that the value where REV_=0 should not be modified by either A or B. When A makes the first modification, a new row with REV_=1 and A’s value (aaa-1) should be inserted. When B makes a later modification, a further new row with REV_=2 and B’s value (aaa-2) should be inserted, incrementing the revision number. Otherwise, how can I find the initial value? Surely I shouldn’t have to look in ACT_HI_DETAIL every time?
Hi,the model is very simple. Startevent——-usertask————endevent.The rev is not the process version,because complete task doesn’t change the process version.Does the column Rev_ is Optimistic Lock? if it is ,I think it is a bug.If not,even if the field value got overidden,but its original value should be retained.
I mean after A complete the task,the variable field is changed,it should be insert into the row with Rev_=1,otherwise the variable value is duplicated on Rev_=0 and Rev_=1.why it delete the row that the variable field value with Rev_=0???
After B complete the task,why it delete the row that the variable field value with Rev_=1???you can see the difference from the image with after A complete and after B complete.
The point is how can I get the variable original value from the database table act_hi_varinst?
Like Filip wrote: we use the REV_ for the optimistic lock
That’s what it is for.
There are use-cases with hundreds of variables per case/process instance. And Thousands of running instances. The way you describe it, that would result in even more data in the runtime tables. Data that is not part of current state of the instance. That is by definition history data and therefore stored in the ACT_HI_DETAIL.
Thanks for your answer. I got it,the truth is that process instance have own variable ,and the task too.they all use optimistic lock. As you said, I need get the original variable by the ACT_HI_DETAIL.In a word,Thank you very much.