cancel
Showing results for 
Search instead for 
Did you mean: 

ProcessInstanceQuery and runtime performance

kermit
Champ in-the-making
Champ in-the-making
Hi,

I defined a process that performs different tasks. During the execution of the process it evaluates new variables.
I have to show a web page with the list of processes that satisfy a certain condition on one of the variables.

I have successfully run a ProcessInstanceQuery().list() method with a filter on that variable
That method  returns a list of ProcessInstance.
However the single element in the list contains only the id of the process instead I also need the value of a variable of the process.

I tried to cast the ProcessInstance to ExecutionEntity  and use the method getVariabile("my var") but I get a "lazy loading outside commandContext" error.

The only alternative seems to loop on the list of results and execute a runtimeService.getVariable("my var") for each element.

Is there a better way to do this in a efficient way (not too many sql queries requests)?

best regards
1 REPLY 1

trademak
Star Contributor
Star Contributor
Hi,

You can write your own database queries to overcome this.
Else you're stuck with the runtimeservice getVariable method.

Best regards,