AnsweredAssumed Answered

how can I force a commit inside java task

Question asked by jcosano on Apr 12, 2011
Latest reply on Apr 13, 2011 by jcosano
I have this code (belongs a java task execution method)

   
while (it.hasNext())
{
   value = it.next();
   startProcessInstance(value);
   timer= (String)value.get("tumod");
   execution.setVariable("LAST_TIMER", timer);
**** FORCE COMMIT HERE  :D ****
}

I have a loop, that creates process instances…  and I would commit in each loop for save last_timer, then if one startProcessInstance fails, next time, process start from a good last_timer, and not duplicate process instances.

Question is, can I force commit?
I try with:

context.getDbSqlSession().flush();
context.getTransactionContext().commit();

But only works in first iteration…

Outcomes