[jboss-user] [jBPM] New message: "start a process within another process in jbpm 4.3"

Al Nadein do-not-reply at jboss.com
Thu Mar 4 13:37:02 EST 2010

User development,

A new message was posted in the thread "start a process within another process in jbpm 4.3":


Author  : Al Nadein
Profile : http://community.jboss.org/people/matrixpooh

Trying to port existing 3.2 workflow implementation into 4.3
My requirement is to be able to calculate a number of sub-processes to start at a certain step of the main process. Since I haven't found the way to do this in jpdl/bpmn, I'm doing this programmatically:
When a main process is instantiated via
ProcessInstance processInstance = WorkflowTest.processEngine.getExecutionService().startProcessInstanceByKey("rmc", variables);
it proceeds through a few java tasks and stops at the wait state. One of those java tasks runs a few calculations and decides to create 2-3 processes (i'm calling them sub-processes for separation of concerns) via:
ProcessInstance processInstance = WorkflowTest.processEngine.getExecutionService().startProcessInstanceByKey("9.any");
The main process stops at the state task and flushes hibernate session.
The hibernate does the following:
inserts records into jbpm4_execution for main process
inserts records into jbpm4_execution for sub-processes
/** does some inserts into history tables */
updates ID_ in jbpm4_execution for main process
updates ID_ in jbpm4_execution for sub-processes   ---- The Exception is throw right here
The exception is thrown due to the ID_ field having a unique constrain. Upon insert, ID_ is null, then it's updated with key_+"."+dbid_ value. So if my dbid is 1090015 and process definition key is "rmc", the ID_ is "rms.109001"
Since hibernate first inserts then updates, it fails to insert the second row that also has ID_=null at that moment.
I can think of only two solutions:
(a) drop unique constrain
(b) add 1 line to ExecutionImpl.java::save() right before saving:
*this.id = this.dbid;*
if (dbSession!=null) {
Both of those solutions don't really look apealing. Any suggestions would be greatly appreciated.


To reply to this message visit the message page: http://community.jboss.org/message/530032#530032

More information about the jboss-user mailing list