AnsweredAssumed Answered

Historic Query on task variable returns empty result

Question asked by mdond on Jun 1, 2011
Latest reply on Jun 6, 2012 by jbarrez
I am trying to query for some historic tasks with the following query:

        List<HistoricTaskInstance> tasks = actHistoryService.createHistoricTaskInstanceQuery()
            .processInstanceId(processId).taskVariableValueEquals("taskType", "specify")
            .orderByHistoricTaskInstanceEndTime().desc().list();

I enabled sql logging to see the generated sql query and it searches for the task variable in the table ACT_HI_DETAIL:

  ==>  Executing: select * from ACT_HI_TASKINST HTI WHERE HTI.PROC_INST_ID_ = ?
and exists ( select HD.ID_ from ACT_HI_DETAIL HD where HD.TYPE_ = 'VariableUpdat
e' and HD.NAME_ = ? and HD.TASK_ID_ = HTI.ID_ and HD.REV_ = (select max(HDM.REV_
) from ACT_HI_DETAIL HDM where HDM.TASK_ID_ = HTI.ID_ and HDM.VAR_TYPE_ = ? and
HDM.NAME_ = ? and HDM.TYPE_ = 'VariableUpdate') and HD.TIME_ = (select max(HDM.T
IME_) from ACT_HI_DETAIL HDM where HDM.TASK_ID_ = HTI.ID_ and HDM.VAR_TYPE_ = ?
and HDM.NAME_ = ? and HDM.TYPE_ = 'VariableUpdate') and HD.VAR_TYPE_ = ? and HD.
TEXT_ = ? ) order by END_TIME_ desc

However this table is completely empty, so no row is returned.

Is there something special to enable writing historic task variables to the table ACT_HI_DETAIL?
If this is the case: Are there performance problems to be expected with writing historic task variables or why is this not enabled by default?

Best regards,
Maarten Donders

Outcomes