Hi!
Using jBPM 5.4.0 Final (but is similar for jBPM 6) we noticed that the REST API "/gwt-console-server/rs/tasks/{idRef}/participation" is pretty slow.
The called query is founded in jbpm-human-task-core-5.4.0.Final.jar in the file /META-INF/Taskorm.xml named "TasksAssignedAsPotentialOwnerByStatusWithGroups":
select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name, OrganizationalEntity potentialOwners where t.archived = 0 and ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and [...]
For users with a large numbers of tasks and groups the previous query takes very long time (in some cases also 2/3 minutes) to return (sometimes just few results).
Why don't apply directly a left join on t.peopleAssignments.potentialOwners instead of use OrganizationalEntity potentialOwners, removing "and potentialOwners in elements ( t.peopleAssignments.potentialOwners )" part?
The use of "OrganizationalEntity potentialOwners" is translated by Hibernate as a cross join.
Please let me know what do you think about that.
Thanks,
Francesco