AnsweredAssumed Answered

Sorting activity instances by 'start time'

Question asked by kuba.v on Feb 28, 2012
Hi,

I would like to display history activity instances in order they were executed so I am doing something like this:
processEngine.getHistoryService().createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).orderByHistoricActivityInstanceStartTime().asc().list()
The problem is that the start time can be same if the steps are processed very quickly. I found a "solution" to write my own sorter which uses the HistoricActivityInstance.getId() as a second sorting key which seems to give me the right order. However referring to this forum:
http://forums.activiti.org/en/viewtopic.php?t=3173&p=12934
where something similar is discussed (sorting of process instances) it apparently works only because the Id generator is sequential which may be changed in the future.

Is there any other way how to assure correct order?

Many thanks!

Outcomes