Search criteria (Candidate User & Candidate Group)


I tried to set the search criteria both candidate User & candidate Group.

It occurs an error with this message.
(Invalid query usage: cannot set both candidateUser and candidateGroup)

But in Task.xml, the code was designed by using ‘OR’, not ‘AND’ between candidate User & candidate Group.

Please let me know what this code means.

Thank you.

< if test=“candidateUser != null || candidateGroups != null”>
< if test=“!includeAssignedTasks”>
and RES.ASSIGNEE_ is null
< /if>
and I.TYPE_ = ‘candidate’
< if test=“candidateUser != null”>
I.USER_ID_ = #{candidateUser}
< /if>
< if test=“candidateUser != null && candidateGroups != null && candidateGroups.size() > 0”>
< /if>
< if test=“candidateGroups != null && candidateGroups.size() > 0”>
< foreach item=“group” index=“index” collection=“candidateGroups” open=“(” separator=“,” close=“)”>
< /foreach>
< /if>
< /if>

If I am not mistaken, the task query performs an AND operation for all specified criteria, including candidate user and group. The code snippet you posted constructs the SQL for that query.

As the question is related to the query execution, I move it to the Process Engine category.