AnsweredAssumed Answered

Query .list() returning wrong size when used with parameter includeProcessVariables() or includeTaskLocalVariables()

Question asked by ilalaina on Aug 4, 2016
Latest reply on Aug 6, 2016 by edsonrichter
Hi all,

I got incorrect results count when using the .list() method on queries with includeProcessVariables() or includeTaskLocalVariables() parameters.
If I don't use .list() but just .count() the result is correct.

I couldn't reproduce the issue in an unit test with new data because I think the issue is related to my existing process variables.

Below are the tests I did :

<sql>SELECT COUNT(DISTINCT PROC_INST_ID_) FROM ACT_RU_EXECUTION; – = 1140</sql>


runtimeService.createProcessInstanceQuery().count(); // Returns 1140 : correct
runtimeService.createProcessInstanceQuery().list().size(); // Returns 1140 : correct
runtimeService.createProcessInstanceQuery().includeProcessVariables().count(); // Returns 1140 : correct
runtimeService.createProcessInstanceQuery().includeProcessVariables().list().size(); // Returns 916 : INCORRECT


<sql>SELECT COUNT(*) FROM ACT_RU_TASK; – = 1182</sql>


taskService.createTaskQuery().count(); // Returns 1182 : correct
taskService.createTaskQuery().list().size(); // Returns 1182 : correct
taskService.createTaskQuery().includeTaskLocalVariables().count(); // Returns 1182 : correct
taskService.createTaskQuery().includeTaskLocalVariables().list().size(); // Returns 1182 : correct
taskService.createTaskQuery().includeProcessVariables().count(); // Returns 1182 : correct
taskService.createTaskQuery().includeProcessVariables().list().size(); // Returns 917 : INCORRECT


<sql>SELECT COUNT(*) FROM ACT_HI_TASKINST; – = 6589</sql>


historyService.createHistoricTaskInstanceQuery().count(); // Returns 6589 : correct
historyService.createHistoricTaskInstanceQuery().list().size(); // Returns 6589 : correct
historyService.createHistoricTaskInstanceQuery().includeTaskLocalVariables().count(); // Returns 6589 : correct
historyService.createHistoricTaskInstanceQuery().includeTaskLocalVariables().list().size(); // Returns 1256 : INCORRECT
historyService.createHistoricTaskInstanceQuery().includeProcessVariables().count(); // Returns 6589 : correct
historyService.createHistoricTaskInstanceQuery().includeProcessVariables().list().size(); // Returns 1256 : INCORRECT


Thanks for your your help.

Outcomes