Date filters are not working in HistoricTaskInstanceQuery in flowable 7.0.1
154ngroves opened this issue · 1 comments
After the upgrade to flowable 7.0.1 this query retrieves also the tasks closed before the provided interval:
historyService.createHistoricTaskInstanceQuery()
.taskCompletedAfter(startDate)
.taskCompletedBefore(endDate)
.includeProcessVariables()
.finished().list()
In flowable 6.8 the same query works, retrieving only the tasks completed between the start date end the end date
I think the bug has been introduced in this commit: 8e2be39
The following "and" clauses have been replaced with "or" clauses:
Query logs with flowable 7.0.1:
o.f.t.s.i.p.e.H.selectHistoricTaskInstancesWithRelatedEntitiesByQueryCriteria:137|==> Preparing: select RES., VAR.ID_ as VAR_ID_, VAR.NAME_ as VAR_NAME_, VAR.VAR_TYPE_ as VAR_TYPE_, VAR.REV_ as VAR_REV_, VAR.PROC_INST_ID_ as VAR_PROC_INST_ID_, VAR.EXECUTION_ID_ as VAR_EXECUTION_ID_, VAR.TASK_ID_ as VAR_TASK_ID_, VAR.META_INFO_ as VAR_META_INFO_, VAR.BYTEARRAY_ID_ as VAR_BYTEARRAY_ID_, VAR.DOUBLE_ as VAR_DOUBLE_, VAR.TEXT_ as VAR_TEXT_, VAR.TEXT2_ as VAR_TEXT2_, VAR.LAST_UPDATED_TIME_ as VAR_LAST_UPDATED_TIME_, VAR.LONG_ as VAR_LONG_, VAR.SCOPE_ID_ AS VAR_SCOPE_ID_, VAR.SUB_SCOPE_ID_ AS VAR_SUB_SCOPE_ID_,VAR.SCOPE_TYPE_ AS VAR_SCOPE_TYPE_ from ( SELECT RES. from ACT_HI_TASKINST RES WHERE RES.END_TIME_ is not null or RES.END_TIME_ < ? or RES.END_TIME_ > ? order by RES.ID_ asc ) RES left outer join ACT_HI_VARINST VAR ON (RES.PROC_INST_ID_ = VAR.EXECUTION_ID_) order by RES.ID_ asc
o.f.t.s.i.p.e.H.selectHistoricTaskInstancesWithRelatedEntitiesByQueryCriteria:137|==> Parameters: 2024-09-12 19:32:15.0(Timestamp), 2024-09-11 19:32:15.0(Timestamp)
Same query logs with flowable 6.8.0
o.f.t.s.i.p.e.H.selectHistoricTaskInstancesWithRelatedEntitiesByQueryCriteria:137|==> Preparing: select RES., VAR.ID_ as VAR_ID_, VAR.NAME_ as VAR_NAME_, VAR.VAR_TYPE_ as VAR_TYPE_, VAR.REV_ as VAR_REV_, VAR.PROC_INST_ID_ as VAR_PROC_INST_ID_, VAR.EXECUTION_ID_ as VAR_EXECUTION_ID_, VAR.TASK_ID_ as VAR_TASK_ID_, VAR.BYTEARRAY_ID_ as VAR_BYTEARRAY_ID_, VAR.DOUBLE_ as VAR_DOUBLE_, VAR.TEXT_ as VAR_TEXT_, VAR.TEXT2_ as VAR_TEXT2_, VAR.LAST_UPDATED_TIME_ as VAR_LAST_UPDATED_TIME_, VAR.LONG_ as VAR_LONG_, VAR.SCOPE_ID_ AS VAR_SCOPE_ID_, VAR.SUB_SCOPE_ID_ AS VAR_SUB_SCOPE_ID_,VAR.SCOPE_TYPE_ AS VAR_SCOPE_TYPE_ from ( SELECT RES. from ACT_HI_TASKINST RES WHERE RES.END_TIME_ is not null and RES.END_TIME_ < ? and RES.END_TIME_ > ? order by RES.ID_ asc ) RES left outer join ACT_HI_VARINST VAR ON (RES.PROC_INST_ID_ = VAR.EXECUTION_ID_) order by RES.ID_ asc
o.f.t.s.i.p.e.H.selectHistoricTaskInstancesWithRelatedEntitiesByQueryCriteria:137|==> Parameters: 2024-09-12 19:32:15.0(Timestamp), 2024-09-11 19:32:15.0(Timestamp)
Duplicates this issue: #3827