You are doing it OK. The problem could be that you are using on memory processes. And the ProcessID is generated when it's stored in the database. You should configure persistence and the processId will be set by the database.
Sorry my mistake - due to the late hour I thought that it's -1, and actually it was 1..
yes. Are you already persisting your processes?
I am trying to run a demo process.
How do I define it in the persistence.xml?
persistence.xml is defined by the JPA spec. You can find a sample persistence.xml file here:
but you probably want to tweak it to your needs and database vendor:
Notice that you must place it inside the META-INF directory.
I know. I already have this file.
I just didn't get it what do I have to change in order to make ProcessID generated when it stored in db.
To which table does it belong?
The process id should in inside the ProcessInstanceInfo table. Before calling the
task.getProcessInstanceId() take a look at the database to see if the process was persisted correctly.
I have again the same problem.
The ProcessInstanceInfo is empty. I have it in persistence.xml and I have human tasks in my BPMN so it's not an in memory process.
what could make it? where do I have to debug? where the ProcessInstanceInfo is being persisted ?
Can you create an isoleted test that demonstrate that functionality?
I think that I found the problem
I wasn't using the JPAKnowledgeService.
I saw your new post http://www.plugtree.com/drools-%E2%80%93-use-case-emergency-service-%E2%80%93-business-process-implementation-part-2/ as well as the documentation about Persistence and will work on it.