Dec 27, 2007

JBPM Database Steps

One of the basic features of jBPM is the ability to persist executions of processes in the database when they are in a wait state.
1. First we create the JBPM Configuration.
Static JbpmConfiguration jBpmConfiguration = null;

This is static as same jbpm configuration can be used for the entire threads configuration.
2. All the configuration related information is stored in resource file “jbpm.cfg.xml”
3. The jBPM configuration is loaded.
jBpmConfiguration = JbpmConfiguration.parseResource ("jbpm.cfg.xml");
4. Get the jBPM context from the jbpm configuration.

jBPMContext = jBpmConfiguration.createJbpmContext ();
5. Get the graph Session from jBPM Context
jbpmGraphSession = jBPMContext.getGraphSession ();
6. Get process definition from Graph Session
ProcessDefinition processDefinition= jbpmGraphSession.findLatestProcessDefinition (“Add Product”);
7. Get process Instance from Process Definition
ProcessInstance processInstance = new ProcessInstance (processDefinition);
After getting the process Instance user can do whatever he wants to do.
Data will not not be persisted in database untill and unless jBPMContext is not closed

1 comment:

  1. Good outlining of the steps! btw, i was trying out an example to persist a process definition on mysql db but i am running into lotz of issues.

    Is there any resource/example available for the same and also for jump starting on various features of jpdl?

    ReplyDelete