[jboss-user] [jBPM] - How to start/spawn 'n' subprocesses for 'n' users using JBPM-4.3.

Al Nadein do-not-reply at jboss.com
Sat Jul 17 16:28:19 EDT 2010

Al Nadein [http://community.jboss.org/people/matrixpooh] replied to the discussion

"How to start/spawn 'n' subprocesses for 'n' users using JBPM-4.3."

To view the discussion, visit: http://community.jboss.org/message/553170#553170

Hi Felix,

     A unique constrain for ID_ on JBMP4_EXECUTION is there to ensure that there don't exist more than 1 process with the same id. Since the only client of this database is the pvm (jbpm process virtual machine) and it's designed having this restriction in mind, there is really no harm to drop the constrain. Being a perfectionist, I still think there should be a code fix, rather than relaxation of the data model constrains. 
     The reason of the error is really a bug. A process is created, then a fork is hit, a child process is created. Both operations are done in memory, nothing is being recorded in a database just yet. Then either a wait state or end of a process is hit. At this moment, a system would try to persist the records: there will be 2 records created - one for the main process, another for the child process. 2 insert statements would be issued, both of them will have "ID_" set to null just because at that moment neither of ID_ values has been calculated yet. This is done with the assumption that there will be a calculation of ID_ values and the updates will be issued immediately in the same transaction. But in this setup, updates have no chance to be issued since the transaction fails to insert the second record due to a duplicate ID_ value, i.e. null. The question is why not to calculate ID_ value upfront and make a single insert instead of insert and then update.
     I did work with HuieSheng to identify and resolve the bug, but then was pulled into some other things and didn't have a chance to follow up on her patch. In short, my project is in production with my patch. Will try to fetch it for you shortly.

Also, wanted to say huge thanks for your process sample: creating an arbitrary number of subprocesses is something I've been trying to do for a while.


Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100717/fc2f90f1/attachment.html 

More information about the jboss-user mailing list