AnsweredAssumed Answered

Problem with .createHistoricProcessInstanceQuery()

Question asked by cnirparis on Dec 2, 2014
Latest reply on Dec 2, 2014 by smirzai
I have a problem with the historic query API.

I've a finished instance which appears in the ACT_HI_PROCINST table with a PROC_DEF_ID_ column with the process definition key (in my example 'MYPROCESS:1:3804'),
and END_TIME_ column with date value of ending.

when I do a sql request like this :

select count(*) from ACT_HI_PROCINST where PROC_DEF_ID_ = 'MYPROCESS:1:3804'

the result value is = 1


Now if I do it with API like this :


long result  = MyProcessEngine
               .getHistoryService()
               .createHistoricProcessInstanceQuery()
               .processDefinitionKey("MYPROCESS:1:3804")
               .finished()
               .count();


I get result = 0


Same problem if I use the processId as selector :


long result  = MyProcessEngine
               .getHistoryService()
               .createHistoricProcessInstanceQuery()
               .processDefinitionId("MYPROCESS")
               .finished()
               .count();

I get result = 0


But if I use the processInstanceId (3806 in my example)

long result  = MyProcessEngine
               .getHistoryService()
               .createHistoricProcessInstanceQuery()
               .processInstanceId("3806")
               .finished()
               .count();


I get result = 1


So it seems we have to use a sql native query, or perhaps there's something wrong in my example ?          

Outcomes