We have updated our project dependency to Activiti 5.11 and we have a need to query ACT_HI_VARINST to acquire some *task* variables instead of having history set level to full and querying ACT_HI_DETAIL. Although a column with TASK_ID_ exists in ACT_HI_VARINST we cannot query by taskId and we cannot also check for the value programmatically. Is there any way to query for task variables with history set to audit?
You have a point, there is no way of querying the process-variables associated to a task. This should be added in 5.12. For now, you can cast the HistoricVariableInstance to a HistoricVariableInstanceEntity. For querying, you're a bit stuck, I see that there is no "native" HistoricVariableInstance possibility. You can either wait until master contains https://jira.codehaus.org/browse/ACT-1540 and use a SNAPHOT (planning on taking this issue on today or tomorrow) OR alter the source-code and build your custom 5.11-version.
Even better, for now, you can cast the HistoricVariableInstanceQuery to the *Impl class, and use taskId() setter method to filter on taskId. This functionality is implemented but not exposed…