ssh+jbpm整合.docx
简述JbPa工作流框架与现有SSh框架的集成工作其实很简尊,但国内外的资料太小,所以会在集成时走入太多误区,本文是在strts1.2,spring2.5,hibernate3.2上集成成功的详细步骤。其中解决了,jbpm的访问数据库session与原有hiberna1.©的session不同的问题,string-max大字段问题。完成了流程部詈web及后台程序。利用springI1.OdU1.US0.8当中的SPring31做为集成的桥梁(其实它已经做好了集成,但文档和实例实在是太简单使用jbpm-starters-kit31.I生成数据阵衣及安装ec1.ipse图形化配置插件1下我jbp三-startcrs-kit-3.1.4到其网站,包含所有需要的工具及jar包2数据库的安装以orac1.e为例.其它数据库可按此例修改.2.1 创立所需用户及表空间,如果有了用户和表空间就不需要了。2.2 找到jbp11rstHrters-ki1.3.1.4文件夹,在其下的jbpm文件夹的下级文件夹Iib中参加orac1.e的驱动包ojdbcM.jar.2.3 在jb三srcresources文件夹下建立OraeIR文件夹,将jbpmsrcresourceshsq1.db里的create.db.hibernate,properties和identity,db.xm1.文件copy到刚刚建立的orac1e文件夹当中.2.4 修改CrCa1.e.dbhibCma1.e.properties文件,修改目标数据库的连接属性如下:甘thesepropertiesarcusedbythebui1.dscripttocreate# ahypersonicdatabaseinthebui1.ddbdirectorythatcontains# thejbpIab1.esandaprocessdep1.oyedintherehibernate,<1.ia1.cct=or.hibernate,dia1.ect.Orac1.eDia1.ccthibernate,connection,driverc1.ass=orac1.e.jdbc.driver.Orac1.eDriverhibernate,connection,ur1.=jdbcrorac1.e:thin:810.62,1,12:1521:orac1.ehibernate,connection,username=dpfhibernate,connection.PaSSWOrd=dfhibernate,showsq1.=truehibernate,cache.provider_c1.ass=org.hibernate,cache.Hashtab1eCacheProvider2.5修改jb<nsrcconfi.fi1eshibernatc.cfg.xm1.文件,同样是配置数据库的连接属性如卜:<!-jdbcconnectionproperties-><propertynamc*=*hibornate.dia1.ect*>org.hibernate,dia1.ect.OracIpDia1.ect<property><roper1.yname-xhibernate.connection,driverc1.assx>orac1e.jdbc.driver.Orac1eDriver<property><propertynane=4rhiborna1.o.connection,ur1.*>jdbc:orac1.e:hi1.,62.1.12:1521:orac1.e</proporty><propertyname=*hibornate.connection.USOrnaBe”>dpf<ProPOrty><propertynamc=*,hibernatc.connection.PaSSWord*>dpf<PrOPCr1.y><ropertyname-xhibernate.cache,provider_c1.ass*>org.hibernate,cache.Hashtab1.eCacheProvider<property>2.6修改jbpmbui1.d.dep1.oy.xn1.文件.找到create,db项并进行如下修改:<!SERVER><tnrgetname-*create.db*depends-*dec1.are.jbp三.tasks,db.c1.eanvdb.start*description-*createsahypersonicdatabasewiththejbpmtab1.esand1.oadstheprocessesinthere*><jbpmschernaactions=*create*Cfg="$(basedir)srcconfi.properties=*51.yasedirsrcresourcesorac1.ecreate.db.hibernate,pro>erties,>< 1oadidentitiesfibasedirsrcresourcesorac1e/identity.db.xm1.*cfg=*J1.basedir)srcconfi.,properties-*5basedirsrcresourcesorac1e/create.db.hibernate,properties*>< antantfi1.ei1.d.xn1.*target=*buiId.processes*inherita1.1.=*fa1.se*>< dep1.oyprocessCfg=飞basedir/Sre/config*properties=*Sbasedirsrcresourcesorac1e/crcatc.db.hibernate.properties*><dir=i1.d*inc1.udes=*,process*><dep1.oyprocess><antca1.1.target=*db.stop*><target>2. 7fii!tnt,在jbpm目录执行antcreate,db-bui1.d命令.会有一些小错误的提示,没有关系数据库的表己经建立完成,2.8ec1.ipse的图形化鼠汽插件安装文件可以到jbp11-starters-kit-3.1.1.jbpa-(1.esignerjb三gpdfeatureecIipse下找到.需注速版本,部署jbpm的jar包和moud1.e的jar包1把如下jar包放入VreBTNF1.ib文件夹下,SPrinirmOdUIeSrbpm31.Jar可以在spring-aodu1.es-O.8下找到,其它的都属于jbn工具包.bsh-,3.O.jarbsf.jarspring-三oduIes-jbp11ki1.jarjbpn-wcbapp-3.1.4.jarjbpa-identity-3.1.4.jarjb-3.1.4.jar部署hbm文件到工程1在Jbpm文件夹中找到所有的"hmxm1.数据库映射文件.放到工程的一个文件夹当中.本例放到comresoftsecurity三ode1h1.xn文件夹中”并且在hibernate的sessionfactory建立时,设置为相关路况配孔2此文件需在Spring管理的hibernate配置文件下修改,本例为dataccessContext-hibernate.xm1.如下:<!-HibernateSessionFatory-><beanid=*sessionFactory*c1.ass=*org.springframework,orm.hi1.>e11atc3annotation.AnnotationSessionFacIoryBean*><propertyname二,dataSource,ref=*dataSourcex>propertyname=*rannotatedC1.asses*><iist><1.ist><property><propertyname=*rhi1.>ernatePropertics”><props><propkey-*,hibernate.dia1.ect*>org.hibernate.dia1.ect.0rac1.e9Dia1.ect<prop><propkey=hibernate.sh_sq1>>true<prop><propkey-*,hibernate.cache.provider_c1.ass*>org.hibernate,cache.EhCacheProvider<prop><propkey=A,hibernate.cache.use_query_cacheA,>tnie</prop></props><property><propertyname=*rty>e)efinitions*><refbean=*jbpmTypes*><property>propertyname=*mappingDirectory1.ocationsA,><iist><va1.ue>c1asspath*:/com/gresoft/securitymodc1.hbm<va1.ue><1.ist><property><bean>设以大字段string-max1此文件需在SPriM管理的hiberna1.。配置文件下修改,本例为dataccessContext-hiIiernate.Km1,如下:<!"处理大字段一<beanid="jbp三Typcs"c1.ass=*org.Springframeirork.orm.hiIwmate3.TypeDefinitio11Hean*><ropertynam。="IyPeNava1uc=*string_max*>(propertyname=*typedass*va1.ue=*org.jbpn.db.hi1.>ernate.StringMax*><bcan>IS!jJtconfigrationtemp1.ate说明:jhpaConfiguration是根据SPring1.nOd1.HCS所提供的1.oca1JbpmConfiguratiOnFactoryBean进行配置,其集成好对jbp11Configuration的管理,在系统使用时JbpCcnfiguration需网用JbpmTemp1.ate的jbpmTnp1.a1.e.getJbpmCcnfigUratiQn()方法得到.1此文件需在SPriM管理的hibemas配置文件下修改,本例为data.ccessContext-hibernate.xm1.*如下:<!-JBPMconfiuration-><beanid=*JbpmConfiguration*c1.ass=*org.Springmcxiu1.es.workf1.ow,jbp三31.1.oca1Jbp<11ConfigurationFactoryBean*><propertyname-*sessionFactory*ref-*sessionFactory*>Cpropertyname=*configuration*va1.ue=A,c1.asspath:/datasq1./