AnsweredAssumed Answered

orderByProcessInstanceId()

Question asked by emiliano on Oct 23, 2012
Latest reply on Oct 23, 2012 by jbarrez
Hi,
I would like to retrieve the list of Tasks owned by a particular user ordered by their processInstanceId, so i have used:


taskService.createTaskQuery().taskAssignee(userId).orderByProcessInstanceId().asc()

Unfortunately I found that the order isn't respected, the task with the processInstanceId 152 was before the task with the piid 85.
I've searched why and i've found that the sql ORDER BY directive works on a varchar column. This drives to an alphanumeric ordering instead of numerical. So ids which start with '1' (es 1000) are positioned before ids which start with '2' (es 20).
Also orderByExecutionId() and orderByTaskId() seems to suffer the same problem.
Does anyone have experience the same problem?
Does exits a workaround?

thanks in advance
emiliano

Outcomes