服务热线:13616026886

技术文档 欢迎使用技术文档,我们为你提供从新手到专业开发者的所有资源,你也可以通过它日益精进

位置:首页 > 技术文档 > JAVA > 新手入门 > 基础入门 > 查看文档

spring+hibernate+jbpm整合成功

终于搞定了,在此感谢chenjin的指点。

从10.31日整合失败后,这块就一直是我的心病,我甚至都跑去了http://www.springframework.org/去发了一个帖,这还是我第一次用英文问问题呢。

最后的配置结果是:

hibernate.cfg.xml、jbpm.cfg.xml在关联spring后保持不变,只需要更改spirng的配置文件就好了。


spring+hibernate+jbpm整合成功<?xml version="1.0" encoding="utf-8"?>
spring+hibernate+jbpm整合成功<!doctype beans public "-//spring//dtd bean//en"
spring+hibernate+jbpm整合成功"http://www.springframework.org/dtd/spring-beans.dtd">
spring+hibernate+jbpm整合成功<beans>
spring+hibernate+jbpm整合成功    <bean id="datasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource">
spring+hibernate+jbpm整合成功        <property name="driverclassname">
spring+hibernate+jbpm整合成功            <value>com.mysql.jdbc.driver</value>
spring+hibernate+jbpm整合成功        </property>
spring+hibernate+jbpm整合成功        <property name="url">
spring+hibernate+jbpm整合成功            <value>jdbc:mysql://localhost:3306/test</value>
spring+hibernate+jbpm整合成功        </property>
spring+hibernate+jbpm整合成功        <property name="username">
spring+hibernate+jbpm整合成功            <value>root</value>
spring+hibernate+jbpm整合成功        </property>
spring+hibernate+jbpm整合成功        <property name="password">
spring+hibernate+jbpm整合成功            <value/>
spring+hibernate+jbpm整合成功        </property>
spring+hibernate+jbpm整合成功    </bean>
spring+hibernate+jbpm整合成功    <!-- hibernate sessionfactory -->
spring+hibernate+jbpm整合成功    <bean id="sessionfactory" class="org.springframework.orm.hibernate3.localsessionfactorybean">
spring+hibernate+jbpm整合成功        <property name="datasource">
spring+hibernate+jbpm整合成功            <ref local="datasource"/>
spring+hibernate+jbpm整合成功        </property>
spring+hibernate+jbpm整合成功        <property name="mappinglocations">  
spring+hibernate+jbpm整合成功           <value>classpath*:/org/jbpm/**/*.hbm.xml</value>  
spring+hibernate+jbpm整合成功           </property>
spring+hibernate+jbpm整合成功        <property name="hibernateproperties">  
spring+hibernate+jbpm整合成功           <props>  
spring+hibernate+jbpm整合成功               <prop key="hibernate.dialect">org.hibernate.dialect.mysqldialect</prop>
spring+hibernate+jbpm整合成功               <prop key="hibernate.hbm2ddl.auto">update</prop>
spring+hibernate+jbpm整合成功               <prop key="hibernate.jdbc.batch_size">0</prop>
spring+hibernate+jbpm整合成功           </props>
spring+hibernate+jbpm整合成功       </property> 
spring+hibernate+jbpm整合成功    </bean>
spring+hibernate+jbpm整合成功    <!-- transaction manager for a single hibernate sessionfactory (alternative to jta) -->
spring+hibernate+jbpm整合成功    <bean id="transactionmanager" class="org.springframework.orm.hibernate3.hibernatetransactionmanager">
spring+hibernate+jbpm整合成功        <property name="sessionfactory">
spring+hibernate+jbpm整合成功            <ref local="sessionfactory"/>
spring+hibernate+jbpm整合成功        </property>
spring+hibernate+jbpm整合成功    </bean>
spring+hibernate+jbpm整合成功    
spring+hibernate+jbpm整合成功    <!-- reading jbpm process definitions -->
spring+hibernate+jbpm整合成功    <bean id="websaleworkflow1" class="org.springmodules.workflow.jbpm31.definition.processdefinitionfactorybean">
spring+hibernate+jbpm整合成功        <property name="definitionlocation"    value="processdefinition.xml"/>
spring+hibernate+jbpm整合成功    </bean>
spring+hibernate+jbpm整合成功    <!-- jbpm configuration--> 
spring+hibernate+jbpm整合成功    <bean id="jbpmconfiguration" class="org.springmodules.workflow.jbpm31.localjbpmconfigurationfactorybean">
spring+hibernate+jbpm整合成功        <property name="sessionfactory" ref="sessionfactory"/>
spring+hibernate+jbpm整合成功        <property name="configuration" value="jbpm.cfg.xml"/>
spring+hibernate+jbpm整合成功        <property name="processdefinitions">
spring+hibernate+jbpm整合成功            <list>
spring+hibernate+jbpm整合成功                <ref local="websaleworkflow1"/>
spring+hibernate+jbpm整合成功            </list>
spring+hibernate+jbpm整合成功        </property>
spring+hibernate+jbpm整合成功        <property name="createschema" value="true"/>
spring+hibernate+jbpm整合成功    </bean>
spring+hibernate+jbpm整合成功    <!-- jbpm template -->
spring+hibernate+jbpm整合成功    <bean id="jbpmtemplate" class="org.springmodules.workflow.jbpm31.jbpmtemplate">
spring+hibernate+jbpm整合成功        <constructor-arg index="0" ref="jbpmconfiguration"/>
spring+hibernate+jbpm整合成功        <constructor-arg index="1" ref="websaleworkflow1"/>
spring+hibernate+jbpm整合成功    </bean>
spring+hibernate+jbpm整合成功
spring+hibernate+jbpm整合成功</beans>
spring+hibernate+jbpm整合成功

 

其中

spring+hibernate+jbpm整合成功<property name="mappinglocations">  
spring+hibernate+jbpm整合成功           <value>classpath*:/org/jbpm/**/*.hbm.xml</value>  
spring+hibernate+jbpm整合成功           </property>

很关键,我就是想spring会通过jbpm找到hibernate.cfg.xml而没有设置,才失败的。

扫描关注微信公众号