`
wang_ping001
  • 浏览: 87331 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

jbpm4.3-spring2.5整合

阅读更多

用了几个小时的时间终于把jbpm与spring整合在一起了。。

这里我用的是myeclipse8.6,jbpm4好像与3.5以下的eclipse不兼容,废话也不多说,下来我介绍我是怎么做的:

1.先建立一个web工程,将jbpm-4.3\examples\src\jbpm.cfg.xml,jbpm.hibernate.cfg.xml,jbpm.mail.properties,jbpm.mail.templates.examples.xml,logging.properties一起拷贝到src目录下。

2.拷贝jbpm-4.3\install\src\cfg\spring下的applicationContext.xml文件到src下,修改内容如下:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
 xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
          http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
          http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
 
 <bean id="dataSource"
  class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
  <property name="url" value="jdbc:sqlserver://localhost:1433;databaseName=jbpm" />
  <property name="username" value="sa" />
  <property name="password" value="000" />
 </bean>

 
 <bean id="sessionFactory"
  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="dataSource" ref="dataSource" />
  <property name="configLocation" value="classpath:jbpm.hibernate.cfg.xml" />
 </bean>

 <bean id="transactionManager"
  class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  <property name="sessionFactory" ref="sessionFactory" />
 </bean>
 
 <bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper" />

 <bean id="processEngine" factory-bean="springHelper"
  factory-method="createProcessEngine" />
  
 <tx:advice id="txAdvice" transaction-manager="transactionManager">
  <tx:attributes>
   <tx:method name="get*" read-only="true" propagation="NOT_SUPPORTED" />
   <tx:method name="find*" read-only="true" propagation="NOT_SUPPORTED" />
   <tx:method name="*" propagation="REQUIRED" />
  </tx:attributes>
 </tx:advice>
</beans>

3.修改 jbpm.hibernate.cfg.xml 内容如下:

<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
  <session-factory>
   
   
     <property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
     <property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
     <property name="hibernate.connection.url">jdbc:sqlserver://localhost:1433;databaseName=jbpm</property>
     <property name="hibernate.connection.username">sa</property>
     <property name="hibernate.connection.password">000</property>
     <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
     <property name="hibernate.hbm2ddl.auto">create-drop</property>
     <property name="hibernate.format_sql">true</property>
    
     <mapping resource="jbpm.repository.hbm.xml" />
     <mapping resource="jbpm.execution.hbm.xml" />
     <mapping resource="jbpm.history.hbm.xml" />
     <mapping resource="jbpm.task.hbm.xml" />
     <mapping resource="jbpm.identity.hbm.xml" />
  </session-factory>
</hibernate-configuration>

分享到:
评论
1 楼 chengzhaoyun 2011-10-27  
谢谢分享资料!

相关推荐

Global site tag (gtag.js) - Google Analytics