cancel
Showing results for 
Search instead for 
Did you mean: 

HistoricActivityInstanceQuery missing a method

rafaelduqueestr
Champ in-the-making
Champ in-the-making
I need to collect end time from a service task. The table who has this information is ACT_HI_ACTINST.
I'm trying to use the query API for collect this information, but i'm unable to do what i need.
I need something like this:

        List<HistoricActivityInstance> result = historyService.createHistoricActivityInstanceQuery()
                .processVariableValueEquals(variableName, variableValue)
                .activityId(activityId)
                .orderByHistoricActivityInstanceEndTime()
                .desc()
                .list();

But the method .processVariableValueEquals(variableName, variableValue) doesn't exist.
Someone has a good solution?
(I don't want to recovery a proc instance, I have a unique variable in my process to do that)

2 REPLIES 2

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

use native queries http://activiti.org/userguide/index.html#queryAPI, or raw access to the DB

Regards
Martin

rafaelduqueestr
Champ in-the-making
Champ in-the-making
I did that.

        List<HistoricActivityInstance> resultado = historyService.createNativeHistoricActivityInstanceQuery()
                .sql(" SELECT atividade.* " +
                     " FROM " + managementService.getTableName(HistoricActivityInstance.class) + " atividade " +
                     " INNER JOIN "+ managementService.getTableName(HistoricVariableInstance.class) +" variavel ON atividade.proc_inst_id_ = variavel.proc_inst_id_ " +
                     " WHERE atividade.act_id_ = #{activityId} " +
                     " AND variavel.name_ = #{variableName} " +
                     " AND variavel.long_ = #{variableValue} " +
                     " ORDER BY atividade.end_time_ DESC ")
                .parameter("variableName", variableName)
                .parameter("variableValue", variableValue)
                .parameter("activityId", activityId)
                .list();