I would have tried doing it the same way. Can you check in the database if it is correctly stored? In the meantime I'll look at the testcases if there is one for this situation with and without db.
Oh... could this be because this task is in my start-state?
If that is the case, then how can I tell that, and find out which "node" in the process the task is for? I see that the Task has a member "startState" which is also null at this time... so that doesn't really help me.
To answer the question from Ronald, i'm using hypersonic DB. So I don't know how to check that. Is there a JDBC driver I can use to talk to that DB (say from eclipse)?
AFAIK, This could happen if the context has not been saved yet, but I'm not sure.
Regarding the HSQLDB, if it is running in jboss, see the end of http://wiki.jboss.org/wiki/Wiki.jsp?page=JbpmGettingStarted
sorry about my stupid question about the jdbc driver. i just found it.
Still then... if it runs in jbpm and has no tcp configured, you will not be able to access it from eclipse, dbvisualizer or whatever if the appserver is running.
Here is the code I used to start the process instance:
ProcessInstance instanceForUpdate = jbpmContext.newProcessInstanceForUpdate(processDefinition.getName()); instanceForUpdate.getTaskMgmtInstance().createStartTaskInstance(); jbpmContext.save(instanceForUpdate); jbpmContext.close();
(I just added the save(), which I didn't think I needed in this case... and it didn't help).
Then at some later time (with a new jbpmContext), I've gotten the task instance as I noted in the initial post.
Does that help? The way I'm starting the workflow seemed a little odd, but seems to work. Was there some other way I'm supposed to do it?
OK. I've confirmed that the TaskInstance is getting persisted. In the DB I can see the Task Instance and it has the proper key in the TASK_ column. The JBPM_TASK table has an entry with a matching ID_.
So I do this in my code:
TaskInstance taskInstance = jbpmContext.loadTaskInstance(instanceId); Task task = taskInstance.getTask(); TaskNode node = task.getTaskNode();
The Task object gets loaded properly, but the TaskNode always comes back null.