Spring with the Jbpm the Integration
1, the necessity of integration:
Business data operations and process operations in the process need to be implemented in the same transaction
For example: leave process--leave the person to submit a leave request, the process jumps to the next node task (JBPM data ) record the leave person information to the user table ( Business Data )
an operation that may involve both JBPM data and business data, if used with two transactions, can lead to inconsistencies in business-to-process data.
2, integration diagram
Integration principle:
( 1 ) using Spring Container IOC provided by beanfactory function Initialization JBPM of the Configuration .
( 2 ) to make business data and JBPM Public sessionfactory .
3,the core ofSpring and Jbpm integration:
(1) generated by the Spring container processengine
(2)Jbpm 's affairs are given to spring processing
4, integration steps
* Import JBPM Jar Package
* Delete the jar packages for DB and Hibernate
* Create a configuration file under Config
config/jbpm
Jbpm.cfg.xml
Jbpm.hibernate.cfg.xml
* in Jbpm.cfg.xml file
<import resource= "Jbpm.tx.hibernate.cfg.xml"/>
instead
<import resource= "Jbpm.tx.spring.cfg.xml"/>
Unification is handled by spring, and by the configuration on the right it is possible to open a transaction by creating a new session
* in Jbpm.hibernate.cfg.xml file
* Connection Configuration of database
<propertyname= "Current_session_context_class" >thread</property>
This line of configuration cannot be written and cannot be retrieved from the current thread
* Map file for the table of OA project itself
* Mapping file for JBPM tables
* Spring configuration file
* Path modification of hibernate configuration file
<bean id= "Sessionfactory" class= "Org.springframework.orm.hibernate3.LocalSessionFactoryBean" > < Property name= "Configlocation" > <value>classpath:jbpm/jbpm.hibernate.cfg.xml</value> </property> </bean>
* Let Spring produce processengine
<bean id= "Springhelper" class= "Org.jbpm.pvm.internal.processengine.SpringHelper" > <property name= " Jbpmcfg "value=" Jbpm/jbpm.cfg.xml "></property> </bean> <bean id=" Processengine "factory-bean=" Springhelper " factory-method=" Createprocessengine "/>
Note the path to the Jbpm.cfg.xml configuration file
5, Summary:
JBPM with the SSH Integration--Let Spring Manage Builds Processengine , let Hibernate Build JBPM entity database tables.
JBPM and Spring Integration