orderByProcessInstanceId()
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2012 04:11 AM
Hi,
I would like to retrieve the list of Tasks owned by a particular user ordered by their processInstanceId, so i have used:
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
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
Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2012 04:15 AM
That's indeed a consequence of using ID's of type String. I'm afraid there is no workaround for this, other than sorting manually. However, the ID is an arbitrary number and by coincidence, the numbers increment trough time. When using the UUID-approach, these ID's don't increment the same way.
What is the exact need for you to order it by process-instance ID? Process-start Timing?
What is the exact need for you to order it by process-instance ID? Process-start Timing?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2012 04:34 AM
What is the exact need for you to order it by process-instance ID? Process-start Timing?
Yes, I'm customizing the explorer to have inbox tasks ordered by start time of their process.
If i sort them manually the pagination of tasks will be wrong.
Are there any tricks to start the ids of execution from 1000000 instead of 1 ? This should workaround the problem for 9000000 ids

thanks
emiliano
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2012 04:36 AM
You can alter the value of "next.dbid" in ACT_GE_PROPERTY after the engine is initialized and shut down. The next time the engine boots, the ID's will start from there…
Can't you use the task-create-time?
Can't you use the task-create-time?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2012 04:58 AM
You can alter the value of "next.dbid" in ACT_GE_PROPERTY after the engine is initialized and shut down. The next time the engine boots, the ID's will start from there…
Excellent, thanks a lot, i'll try it.
Can't you use the task-create-time?
My Customer wants the list of tasks sorted by process creation time, so I've to respect its wishes.
best regards
emiliano
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2012 05:45 PM
My Customer wants the list of tasks sorted by process creation time, so I've to respect its wishes.
Then use the historyService to fetch the HistoricProcessInstance of your ProcessInstance. That one has a start date.
