JBoss Community

Re: getProcess in ProcessInstanceImpl throws a NullPointerException

created by Marco Rietveld in jBPM - View the full discussion

Having written what I've written above (about not fooling around with tx's and the engine), if you are really, really, really, really, really, really sure that you want to go down that road, you can do the following:

 

Start and  end the JTA transaction yourself.

 

It's that simple: the core persistence mechanism in Drools/jBPM checks to see if there's an active transaction first before starting one -- and it also keeps track of whether or not it started a transaction. That way, it will  not commit the transaction if it has also not started the transaction.

 

However, as Elmer Fudd used to say, be vewy, vewy careful when you're doing this. Open the tx, do your thing with the engine and close the tx immediately: remember that the process instance state is saved only when the transaction commits. If you do 2 or more actions that modify the process instance, you'll probably be okay. If you modify the processs instance state and "reach into the engine" to do weird things, good luck!

 

Some of the other core committers to the jBPM project would disagree with me about this: they might say "Ahh, Marco's being a wimp -- there are no problems with tx's. Go ahead and have a transaction party!". They will be right 99% of the time -- but if you get into complicated (high load/performance) situations with jBPM and user-controlled tx's, I'd wouldn't bet on it.

Reply to this message by going to Community

Start a new discussion in jBPM at Community