3 Replies Latest reply on Oct 7, 2008 8:45 PM by Naresh Bhatia

    Finding all running process instances for a process definiti

    Naresh Bhatia Novice

      How do I find all running process instances for a process definition? I tried GraphSession.findProcessInstances(long processDefinitionId), but this method returns all process instances including those that have ended (potentially a very expensive query).

      I found the following named query in hibernate.queries.hbm.xml. This is exactly what I need, but I cannot find any method in the source that uses this query.

       <query name="GraphSession.findAllRunningProcessInstancesWithProcessName">
       select pi
       from org.jbpm.graph.exe.ProcessInstance as pi
       where pi.processDefinition.name = :processDefinitionName
       and pi.end = null
       order by pi.start desc

      Can someone tell me how I can leverage this query? (I am using jBPM 3.2.3).