[jboss-user] [JBoss jBPM] - How does jBPM handle persistance

grin1dan do-not-reply at jboss.com
Tue Jul 22 14:23:55 EDT 2008


Hello All...I am looking for a little guidance on determining exactly how jBPM handles persistance.  I found a decent excerpt but I wonder if anyone could tell me a little more about what the "JbpmContext" is:

Database and transactions
The basic jBPM workings do not require any persistency, it is an optional step to make process definitions and instances persistent. This is done by surrounding the jBPM operations with the retrieval of a "JbpmContext" and using its methods to persist the entities.

A JbpmContext requires closing, which will close the services managed by the context, among which the "PersistenceService", and upon closing this service, the database transaction will be committed, or rolled back if JbpmContext.setRollbackOnly() was called. (The PersistenceService by default starts a transaction when the database connection is first retrieved).

So it is upon us (of course) to call JbpmContext.setRollbackOnly() in case an exception occurs, where we don't want things to persist.

If we want to do things in the same database transaction as jBPM, we can do this inside the same JbpmContext retrieve/close block, by getting the connection using JbpmContext.getConnection() or the hibernate session using JbpmContext.getSession().


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4165964#4165964

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4165964



More information about the jboss-user mailing list