接<<spring+hibernate+jbpm整合失败>>
终于搞定了,在此感谢chenjin的指点。
从10.31日整合失败后,这块就一直是我的心病,我甚至都跑去了http://www.springframework.org/去发了一个帖,这还是我第一次用英文问问题呢。
最后的配置结果是:
hibernate.cfg.xml、jbpm.cfg.xml在关联spring后保持不变,只需要更改spirng的配置文件就好了。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName">
            <value>com.mysql.jdbc.Driver</value>
        </property>
        <property name="url">
            <value>jdbc:mysql://localhost:3306/test</value>
        </property>
        <property name="username">
            <value>root</value>
        </property>
        <property name="password">
            <value/>
        </property>
    </bean>
    <!-- Hibernate SessionFactory -->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource">
            <ref local="dataSource"/>
        </property>
        <property name="mappingLocations"> 
           <value>classpath*:/org/jbpm/**/*.hbm.xml</value> 
           </property>
        <property name="hibernateProperties"> 
           <props> 
               <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
               <prop key="hibernate.hbm2ddl.auto">update</prop>
               <prop key="hibernate.jdbc.batch_size">0</prop>
           </props>
       </property>
    </bean>
    <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory">
            <ref local="sessionFactory"/>
        </property>
    </bean>
   
    <!-- reading jBPM process definitions -->
    <bean id="websaleWorkflow1" class="org.springmodules.workflow.jbpm31.definition.ProcessDefinitionFactoryBean">
        <property name="definitionLocation"    value="processdefinition.xml"/>
    </bean>
    <!-- jBPM configuration-->
    <bean id="jbpmConfiguration" class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean">
        <property name="sessionFactory" ref="sessionFactory"/>
        <property name="configuration" value="jbpm.cfg.xml"/>
        <property name="processDefinitions">
            <list>
                <ref local="websaleWorkflow1"/>
            </list>
        </property>
        <property name="createSchema" value="true"/>
    </bean>
    <!-- jBPM template -->
    <bean id="jbpmTemplate" class="org.springmodules.workflow.jbpm31.JbpmTemplate">
        <constructor-arg index="0" ref="jbpmConfiguration"/>
        <constructor-arg index="1" ref="websaleWorkflow1"/>
    </bean>
</beans>
其中
<property name="mappingLocations"> 
           <value>classpath*:/org/jbpm/**/*.hbm.xml</value> 
           </property>
很关键,我就是想spring会通过jbpm找到hibernate.cfg.xml而没有设置,才失败的。
 
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/jeffen2006/archive/2006/11/13/1381709.aspx