当前位置:文档之家› jbpm整合ssh详解

jbpm整合ssh详解

Jbpm工作流与ssh框架集成目录简述使用jbpm-starters-kit-3.1.4生成数据库表及安装eclipse图形化配置插件部署jbpm的jar包和moudle的jar包部署hbm文件到项目设置大字段string-max配置configration、template过滤器的设置与建立编写发布流程定义xml的人机页面及程序写在最后简述Jbpm工作流框架与现有ssh框架的集成工作其实很简单,但国内外的资料太小,所以会在集成时走入太多误区,本文是在struts1.2,spring2.5,hibernat e3.2上集成成功的详细步骤。

其中解决了,jbpm的访问数据库session与原有h ibernate的session不同的问题,string-max大字段问题。

完成了流程部署web 及后台程序。

利用spring-modules-0.8当中的spring31做为集成的桥梁(其实它已经做好了集成,但文档和实例实在是太简单)。

使用jbpm-starters-kit-3.1.4生成数据库表及安装eclipse图形化配置插件1下载jbpm-starters-kit-3.1.4到其网站,包含所有需要的工具及jar包。

2数据库的安装以oracle为例,其它数据库可按此例修改。

2.1创建所需用户及表空间,如果有了用户和表空间就不需要了。

2.2 找到jbpm-starters-kit-3.1.4文件夹,在其下的jbpm文件夹的下级文件夹lib中加入oracle的驱动包ojdbc14.jar.2.3 在jbpm\src\resources文件夹下建立oracle文件夹, 将\jbpm\src\resou rces\hsqldb里的create.db.hibernate.properties和identity.db.xml文件copy到刚刚建立的oracle文件夹当中.2.4 修改create.db.hibernate.properties文件,修改目标数据库的连接属性如下:# these properties are used by the build script to create# a hypersonic database in the build/db directory that contains# the jbpm tables and a process deployed in therehibernate.dialect=org.hibernate.dialect.OracleDialecthibernate.connection.driver_class=oracle.jdbc.driver.OracleDriverhibernate.connection.url=jdbc:oracle:thin:@10.62.1.12:1521:oracleername=dpfhibernate.connection.password=dpfhibernate.show_sql=truehibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider2.5 修改jbpm\src\config.files\hibernate.cfg.xml文件,同样是配置数据库的连接属性如下:<!-- jdbc connection properties --><property name="hibernate.dialect">org.hibernate.dialect.OracleDialec t</property><property name="hibernate.connection.driver_class">oracle.jdbc.driver.Oracl eDriver</property><property name="hibernate.connection.url">jdbc:oracle:thin:@10.62.1.12:15 21:oracle</property><property name="ername">dpf</property><property name="hibernate.connection.password">dpf</property> <property name="hibernate.cache.provider_class">org.hibernate.cache.Hasht ableCacheProvider</property>2.6 修改jbpm\build.deploy.xml文件.找到create.db项并进行如下修改:<!-- ============== --><!-- === SERVER === --><!-- ============== --><target name="create.db" depends="declare.jbpm.tasks, db.clean, db.st art" description="creates a hypersonic database with the jbpm tables and l oads the processes in there"><jbpmschema actions="create"cfg="${basedir}/src/config.files/hibernate.cfg.xml"properties="${basedir}/src/resources/oracle/create.db.hi bernate.properties"/><loadidentities file="${basedir}/src/resources/oracle/identity.db.xml"cfg="${basedir}/src/config.files/hibernate.cfg.xml"properties="${basedir}/src/resources/oracle/create.db.hi bernate.properties"/><ant antfile="build.xml" target="build.processes" inheritall="false" /><deployprocess cfg="${basedir}/src/config.files/hibernate.cfg.xml"properties="${basedir}/src/resources/oracle/create.d b.hibernate.properties"><fileset dir="build" includes="*.process" /></deployprocess><antcall target="db.stop" /></target>2.7 配置ant,在jbpm目录执行ant create.db –buildfile build.deploy.xml 命令。

会有一些小错误的提示,没有关系数据库的表已经建立完成。

2.8 eclipse的图形化配置插件安装文件可以到jbpm-starters-kit-3.1.4\jbpm -designer\jbpm-gpd-feature\eclipse下找到,需注意版本。

部署jbpm的jar包和moudle的jar包1 把如下jar包放入\WEB-INF\lib文件夹下, spring-modules-jbpm31.jar可以在spring-modules-0.8下找到,其它的都属于jbpm工具包。

bsh-1.3.0.jarbsf.jarspring-modules-jbpm31.jarjbpm-webapp-3.1.4.jarjbpm-identity-3.1.4.jarjbpm-3.1.4.jar部署hbm文件到项目1 在jbpm文件夹中找到所有的*.hbm.xml数据库映射文件。

放到项目的一个文件夹当中。

本例放到\com\gresoft\security\model\hbm文件夹中。

并且在hibernate的sessionfactory建立时,设置为相关路径配置。

2 此文件需在spring管理的hibernate配置文件下修改,本例为dataAccessContext-hibernate.xml,如下:<!--Hibernate SessionFatory--><bean id="sessionFactory"class="org.springframework.orm.hibernate3.annotation.Anno tationSessionFactoryBean"><property name="dataSource" ref="dataSource" /><property name="annotatedClasses"><list></list></property><property name="hibernateProperties"><props><prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop><prop key="hibernate.show_sql">true</prop><prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop><prop key="e_query_cache">true</ prop></props></property><property name="typeDefinitions"><ref bean="jbpmTypes" /></property><property name="mappingDirectoryLocations"><list><value>classpath*:/com/gresoft/security/model/hbm/</value></list></property></bean>设置大字段string-max1 此文件需在spring管理的hibernate配置文件下修改,本例为dataAccessContext-hibernate.xml,如下:<!-- 处理大字段 --><bean id="jbpmTypes" class="org.springframework.orm.hibernat e3.TypeDefinitionBean"><property name="typeName" value="string_max" /><property name="typeClass" value="org.jbpm.db.hibernate.St ringMax" /></bean>配置configration、template说明:jbpmConfiguration是根据springmodules所提供的LocalJbpmConfigurationFactoryBean进行配置,其集成好对jbpmConfigurat ion的管理。

相关主题