I personally never displayed taskvariables in my tasklist. I display the businesskey, which is in most cases enough and if I need more info, I runtime gave the task description a sensible value and display that.
Yeah, my suggestion here is the following.
First, I dont think this is as efficient as it should be. However, this is my suggestion at the most efficient result.
Create a DTO that includes the values you want in the grid. Then do a HQL query to fetch the task instance. The key is to make the variable local to the task instance so that it can be pulled in a eager fashion.
So, when you create your task, just add a controller that copies the value from the process instance to the task. That is equivalent to creating a variable locally on the task instance.
So, then you need to fetch the variable eagerly.
"select task from org.jbpm.taskmgmt.exe.TaskInstance task fetch all properties left join fetch task.variableInstances varInstance"
When you are populating your DTO from your TaskInstance objects gathered in the HQL query, make sure you say "getVariableLocally("variableName") rather than the getVariable method. That is crucial.