cancel
Showing results for 
Search instead for 
Did you mean: 

Historic Query on task variable returns empty result

mdond
Champ in-the-making
Champ in-the-making
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
4 REPLIES 4

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Maarten,

Have a look at the different history levels in the docs.  You need 'full' for this afaik…

mdond
Champ in-the-making
Champ in-the-making
Hi Ronald,

thanks a lot. Exactly what I needed.

groetjes,
Maarten

chaoyy
Champ in-the-making
Champ in-the-making
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

How to enabl sql logging to see the generated sql query in Activity?Which file to config?

jbarrez
Star Contributor
Star Contributor
That is default java.util.Logging. Just add a logging.properties on your classpath. Check the activiti source to find such a file for inspiration.