1 Reply Latest reply on Oct 1, 2012 5:26 AM by Maciej Swiderski

    JPAWorkingMemoryDbLogger logs inconsistent data in case the process instance flow starts and terminates in single thread

    Rahul Agrawal Newbie

      When a process is defined such that there are no wait-states in the flow i.e. the process instance flow will be completed in the same thread, in which it is started, the JPAWorkingMemoryDbLogger is not recording the end data for that particular ProcessInstanceLog.


      One more point: I am starting the transaction and commiting it.



      More analysis reveals that


      In case of start and completion of the process instance in the single thread the below method will execute the query.

      But as the transaction is not commited the query is unable to find the processinstancelog object.



      private void updateProcessLog(long processInstanceId) {

              List<ProcessInstanceLog> result = getEntityManager().createQuery(

                  "from ProcessInstanceLog as log where log.processInstanceId = ? and log.end is null")

                      .setParameter(1, processInstanceId).getResultList();

              if (result != null && result.size() != 0) {

                  ProcessInstanceLog log = result.get(result.size() - 1);

                  log.setEnd(new Date());





      My work-around is to have a map field JPAWorkingMemoryDbLogger inside this class it will store the processInstanceLog object created against the processInstanceId and inside the above method if query is unable to find the object, use the object from the map. If the EntityManager is able to find processInstanceLog, remove it from the map.


      Should I raise a JIRA-issue for this.?