there is a testcase for this: org.jbpm.test.task.TaskQueryProcessTest, so I tend to assume there is no bug, but of course you never know, can you provide a testcase?
This is the best I can do. Of any use?
String processInstanceId = (set somewhere) => Tomcat in debug mode shows it has value 7
TaskService taskService = processEngine.getTaskService();
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).uniqueResult();
I get a NullPointerException, because task is null. Looking in the database, its procinst_ field is set to 7.
(I use the uniqueResult because there can only be one task at this stage for the process instance)
org.jbpm.test.task.TaskQueryProcessTest is not in my distribution of 4.4, btw. There are only 5 packages under org.jbpm.test, task is not one of them.
the full path is
it was added in Revision 5032 at June 12th 2009, so it should be in 4.4
If you set the following parameters in your jbpm.hibernate.cfg.xml
then you can see the query being generated by jBPM and work out why your task isn't being loaded by running it directly on the database.
I had a similar problem and it turned out that it was because my task had never been persisted.
(spring configuration mistake on my part).