cancel
Showing results for 
Search instead for 
Did you mean: 

historyService: variables have revision # 0 all the time

gant
Champ in-the-making
Champ in-the-making
Hi,

I have a simple process with two script task in sequence. At process start, I pass in a variable x with value 4, in the first task, my script is x=x+1, in the second task x=x+2. If I look up the variable with historyService after the execution, revision is 0 at anytime:

ProcessInstance procInst = runtimeService.startProcessInstanceByKey(processDefinitionId, variables);
   List<HistoricDetail> variablesUpdateList = historyService.createHistoricDetailQuery().processInstanceId(procInst.getProcessInstanceId()).list();
      for (HistoricDetail histDet : variablesUpdateList){
         HistoricVariableUpdate var = (HistoricVariableUpdate) histDet;
         System.out.println("Name: " + var.getVariableName() +" * Value: "+ var.getValue()+" * Revision: "+ var.getRevision() +" * Time: "+ var.getTime().getTime());
      }


has following output:

Name: x * Wert: 4 * Revision: 0 * Time: 1313752726000
Name: x * Wert: 5.0 * Revision: 0 * Time: 1313752727000
Name: x * Wert: 7.0 * Revision: 0 * Time: 1313752727000

I set the history level to 'full' in my config-file. If I query the database, history level is set to 3, which is correct in my opinion.

Why is the timestamp always the same? Even if the process is very short-running, in my point of view, the timestamps should differ a little, or when is the timestamp set?

I need to query for the last value of my variables, so if the revision is always 0, is the returned list ordered? So the last list entry would always hold the latest value of the variable. What I want to achieve is to get the "output-variables" of my process this way, is there another solution for that?

Thanks
michael
3 REPLIES 3

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
the revision is always zero since every insert is a new record. The timestamp accuracy is one second (the first one IS DIFFERENT)

gant
Champ in-the-making
Champ in-the-making
so any other way, to get the latest value of a variable modified during processes? Is it possible to raise the accuracy of the timestamp, I think yes, but where?

Regards,
michael

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
via the runtime service you'll get the latest version of the variable