I make a HistoricTaskInstance query by HistoryService:
List<HistoricTaskInstance> doneTasks = historyService.createHistoricTaskInstanceQuery()
.processInstanceId(processInstanceId)
.processUnfinished()
.finished()
.taskDeleteReason("completed")
.orderByHistoricTaskInstanceEndTime()
.desc()
.list();
When I use InMemory(H2) database, the query is OK, but When I use Oracle10, it will error:"ORA-00918".I found that, the two query conditions processUnfinished() and orderByHistoricTaskInstanceEndTime() can not occurs simultaneously.So I add the table abbreviation prefix for the START and END variable in HistoricTaskInstanceQueryProperty class:
// To avoid the ora-00918 error:
START = new HistoricTaskInstanceQueryProperty("HTI.START_TIME_");
END = new HistoricTaskInstanceQueryProperty("HTI.END_TIME_");
The table abbreviation prefix is found in "db/mapping/entity/HistoricTaskInstance.xml" file.After that, The query in oracle will be OK.I hope Activiti developer can solve the bug for oracle database.