Jun 3rd, 2006, 01:50 PM
progress w/jbpm and spring
Here's how I am incorporating jBPM 3.1 into an existing Hibernate3/Spring app. My goal is to have a single SessionFactory for jBPM and the rest of my app, so everything participates in the same Spring declarative transactions.
- add jbpm-3.1.1.jar to WEB-INF/lib.
- in applicationContext.xml, I created a bean for JbpmConfiguration
<!-- pass in existing sessionFactory -->
<property name="sessionFactory" ref="sessionFactory"/>
<property name="configuration" value="WEB-INF/jbpm.cfg.xml"/>
<bean id="process1" class="org.springmodules.workflow.jbpm31.definitio n.ProcessDefinitionFactoryBean">
<property name="definitionLocation" value="WEB-INF/process1.xml"/>
- sessionFactory/hibernate configuration has to incorporate all of the jBPM org.jbpm.....hbm.xml mappings *and*your own.
- jbpm.cfg.xml copy-pasted from jBPM docs, but I took out reference to hibernate.cfg.xml since the SessionFactory is being provided via Spring.
- process defs (process1.xml etc.) are normal.
- you have to create the DB tables yourself somehow.
Only problem: it seems like this is causing a new version of each process to be redeployed to the jbpm_processdefinition table every time the app is restarted. This seems a little odd, and may make the Spring-based process deployment less useful.