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.
from org.jbpm.graph.def.Node node,
where token.processInstance = :processInstance
and token.node = node
and token.isSuspended != true
and token.parent is not null
and token.end is null