I found a bug in the treatment of HistoricDetail (VariableUpdate type) in later versions to 5.16.4.
It is occours when I store variables in a UserTask with "processEngine.getTaskService().setVariable()", without completing the UserTask.
If I store variables with:
processEngine.getTaskService().setVariable(taskId, "var_1", "this is a save var");
With activiti 18.104.22.168. In the database. ACT_HI_DETAIL table: the "ACT_INST_ID_" field is null.
With activiti 5.16.4 the field has the correct value (the ID of the activity).
I attached two JUnit tests to prove it: activiti-unit-test-hcovardetail_5.16.4_OK.zip and activiti-unit-test-hcovardetail_22.214.171.124_FAIL.zip
@Aitor: thanks for the detailed bug description and for the unit tests, they have been very useful.
Indeed the problem was that the ACT_INST_ID_ value was not inserted, thus the query did not returned the entry. See
In order to reproduce it the HistoryLevel must be set to FULL.
The bug was introduced in this commit some time ago:
I have fixed it and created a pull request: