I try to use this query but there's a problem with the condition token.parent is not null, because if the token is the root token the parent is null... I don't understand why this condition is in the query.
I think a select DISTINCT node is also needed.
<query name="GraphSession.findActiveNodesByProcessInstance"> <![CDATA[ select node from org.jbpm.graph.def.Node node, org.jbpm.graph.exe.Token token, org.jbpm.graph.exe.ProcessInstance processInstance where token.processInstance = :processInstance and token.node = node and token.isSuspended != true and token.parent is not null and token.end is null ]]> </query>