熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java開源技術 >> 正文

spring+hibernate+jbpm整合成功

2013-11-23 20:07:46  來源: Java開源技術 

  終於搞定了在此感謝chenjin的指點

  從日整合失敗後這塊就一直是我的心病我甚至都跑去了去發了一個帖這還是我第一次用英文問問題呢

  最後的配置結果是

  hibernatecfgxmljbpmcfgxml在關聯spring後保持不變只需要更改spirng的配置文件就好了




<?xml version= encoding=UTF?>
<!DOCTYPE beans PUBLIC //SPRING//DTD BEAN//EN
beansdtd>
<beans>
    <bean id=dataSource class=orgspringframeworkjdbcdatasourceDriverManagerDataSource>
        <property name=driverClassName>
            <value>commysqljdbcDriver</value>
        </property>
        <property name=url>
            <value>jdbc:mysql://localhost:/test</value>
        </property>
        <property name=username>
            <value>root</value>
        </property>
        <property name=password>
            <value/>
        </property>
    </bean>
    <! Hibernate SessionFactory >
    <bean id=sessionFactory class=orgspringframeworkormhibernateLocalSessionFactoryBean>
        <property name=dataSource>
            <ref local=dataSource/>
        </property>
        <property name=mappingLocations>  
           <value>classpath*:/org/jbpm/**/*hbmxml</value>  
           </property>
        <property name=hibernateProperties>  
           <props>  
               <prop key=hibernatedialect>orghibernatedialectMySQLDialect</prop>
               <prop key=hibernatehbmddlauto>update</prop>
               <prop key=hibernatejdbcbatch_size></prop>
           </props>
       </property> 
    </bean>
    <! Transaction manager for a single Hibernate SessionFactory (alternative to JTA) >
    <bean id=transactionManager class=orgspringframeworkormhibernateHibernateTransactionManager>
        <property name=sessionFactory>
            <ref local=sessionFactory/>
        </property>
    </bean>
    
    <! reading jBPM process definitions >
    <bean id=websaleWorkflow class=orgspringmodulesworkflowjbpmdefinitionProcessDefinitionFactoryBean>
        <property name=definitionLocation    value=processdefinitionxml/>
    </bean>
    <! jBPM configuration
    <bean id=jbpmConfiguration class=orgspringmodulesworkflowjbpmLocalJbpmConfigurationFactoryBean>
        <property name=sessionFactory ref=sessionFactory/>
        <property name=configuration value=jbpmcfgxml/>
        <property name=processDefinitions>
            <list>
                <ref local=websaleWorkflow/>
            </list>
        </property>
        <property name=createSchema value=true/>
    </bean>
    <! jBPM template >
    <bean id=jbpmTemplate class=orgspringmodulesworkflowjbpmJbpmTemplate>
        <constructorarg index= ref=jbpmConfiguration/>
        <constructorarg index= ref=websaleWorkflow/>
    </bean>

</beans>

  其中



<property name=mappingLocations>  
           <value>classpath*:/org/jbpm/**/*hbmxml</value>  
           </property>

  很關鍵我就是想spring會通過jbpm找到hibernatecfgxml而沒有設置才失敗的


From:http://tw.wingwit.com/Article/program/Java/ky/201311/27975.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.