cancel
Showing results for 
Search instead for 
Did you mean: 

HistoricTaskInstanceQuery how to?

gromar
Champ in-the-making
Champ in-the-making
Hello,

I would need to query (historyService.createHistoricTaskInstanceQuery()) for:
( tasks finished or started after specific date  ) && (finished after their dueDate).

*Questions*
How to build such a query? (I did not see any possibility to build it with current HistoricTaskInstanceQuery, NativeHistoricTaskInstanceQuery depends on used DB.)

I can extend HistoricTaskInstanceQuery, or Does anybody see other solution for querying HistoricTaskInstances?
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
NativeHistoricTaskInstanceQuery -> This is the way to go, if you don't want to build a custom activiti-engine.jar. See what SQL the normal HistricTaskInstanceQuery produces (if used as close as possible to your use case) and alter accordingly.

If you don't want to use a full custom SQL, you can alter the HistoricTaskInstanceQuery and *Impl and add all new properties you introduce to the HistoricTaskInstance.xml mapping file. There will be a "select***byQueryCriteria", this is where you should use the new introduced properties of the query to add additional fragments of SQL to the where-clause…