ase you update a process object that was not fetched // with a ...ForUpdate method, you have to save it. jbpmContext.save(processInstance); finally { jbpmContext.close(); }
A JbpmContext separates jBPM from a sprecific environment. For each service that jBPM uses, there is an interface specified in the jBPM codebase. jBPM also includes implementations that implement these services by using services in a specific environment. e.g. a hibernate session, a JMS asynchronous messaging system, ...
A JbpmContext can demarcate a transaction. When a PersistenceService is fetched from the JbpmContext, the default implementation for the persistence service will create a hibernate session and start a transaction. So that transactions can be configured in the hibernate configuration.
A JbpmContext allows the user to overwrite (or make complete) the configuration by injecting objects programmatically. like e.g. a hibernate session factory or a hibernate session or any other resource that can be fetched or created from the configuration.
Last but not least, JbpmContext provides convenient access to the most common operations such as {@link #getTaskList(String)}, {@link #newProcessInstance(String)}{@link #loadTaskInstanceForUpdate(long)} and {@link #save(ProcessInstance)}.
All the ...ForUpdate(...)
methods will automatically save the loaded objects at jbpmContext.close();