Hm.. I'm trying to understand your requirements here..
So you want to find out who was the last person of completing a task related with a process right?
If that's the requirement, yes a named query will be the answer.
Take a look at the orm.xml file provided inside the jbpm-human-task module to add an extra query that recieves the process instance ID and order the task by the last completed within that process instance. The syntax for the named queries is standard (JPAQL - HQL) syntax so you can find tons of examples if you google JPA named queries or JPA QL.
PS: first hit-> http://download.oracle.com/javaee/5/tutorial/doc/bnbtg.html
Thanks for the fast reponse. I will try it out.
Hi Mauricio, I had briefly went through the tutorial and some other pages on the internet.
So should I create my own EntityManager and use its createNamedQuery(String arg0) method to execute the query?
Or I can actually use the query(qlString, size, offset, responseHandler) method of org.jbpm.task.service.TaskClient class for convinience?
If I can, how do I pass in the processInstanceId into this query method?