SQL exception with Task query after upgrade to 6.7.0

You are right @ilgrosso thanks a lot for the PR, we’ll integrate it shortly.

For the time being you can adjust your query a bit to:

TaskQuery query = engine.getTaskService().createTaskQuery().taskWithFormKey();
query.processInstanceBusinessKeyLike(FlowableRuntimeUtils.getProcBusinessKey("%", userKey));
query.or().taskCandidateUser(authUser).taskAssignee(authUser).endOr();
query.listPage(page, size);

Doing this will generate the following SQL:

SELECT RES.*
from ACT_RU_TASK RES
WHERE exists(select 1 from ACT_RU_EXECUTION E WHERE RES.PROC_INST_ID_ = E.ID_ and E.BUSINESS_KEY_ like ?)
  and RES.FORM_KEY_ IS NOT NULL
  and (RES.ASSIGNEE_ = ? or (RES.ASSIGNEE_ is null and exists(select LINK.ID_
                                                              from ACT_RU_IDENTITYLINK LINK
                                                              where LINK.TYPE_ = 'candidate' and LINK.TASK_ID_ = RES.ID_ and (LINK.USER_ID_ = ?))))
order by RES.ID_ asc 
LIMIT ?
OFFSET ?

and if the user is a member of some groups it will generate the following:

SELECT RES.*
from ACT_RU_TASK RES
WHERE exists(select 1 from ACT_RU_EXECUTION E WHERE RES.PROC_INST_ID_ = E.ID_ and E.BUSINESS_KEY_ like ?)
  and RES.FORM_KEY_ IS NOT NULL
  and (RES.ASSIGNEE_ = ? or (RES.ASSIGNEE_ is null and exists(select LINK.ID_
                                                              from ACT_RU_IDENTITYLINK LINK
                                                              where LINK.TYPE_ = 'candidate'
                                                                and LINK.TASK_ID_ = RES.ID_
                                                                and (LINK.USER_ID_ = ? or (LINK.GROUP_ID_ IN (?, ?))))))
order by RES.ID_ asc
LIMIT ?
OFFSET ?

Which is identical to the taskCandidateOrAssigned call.

Cheers,
Filip

1 Like