• spring 多数据库(数据源) JTA 事务2


    1. <?xml version=”1.0″ encoding=”UTF-8″?>  
    2. <beans xmlns=”http://www.springframework.org/schema/beans”  
    3. xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:aop=”http://www.springframework.org/schema/aop”  
    4. xmlns:tx=”http://www.springframework.org/schema/tx”  
    5. xsi:schemaLocation=”http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd  
    6. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd  
    7. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd”>  
    8.   
    9. <bean id=”jotm” class=”org.springframework.transaction.jta.JotmFactoryBean”/>  
    10. <bean id=”txManager” class=”org.springframework.transaction.jta.JtaTransactionManager”>  
    11. <property name=”userTransaction” ref=”jotm”/>  
    12. </bean>  
    13.   
    14. <bean id=”dataSourceA” class=”org.enhydra.jdbc.pool.StandardXAPoolDataSource”  
    15. destroy-method=”shutdown”>  
    16. <property name=”dataSource”>  
    17. <bean class=”org.enhydra.jdbc.standard.StandardXADataSource” destroy-method=”shutdown”>  
    18. <property name=”transactionManager” ref=”jotm”/>  
    19. <property name=”driverName” value=”oracle.jdbc.driver.OracleDriver”/>  
    20. <property name=”url” value=”jdbc:oracle:thin:@10.2.224.44:1521:trade”/>  
    21. </bean>  
    22. </property>  
    23. <property name=”user” value=”crm_aep”/>  
    24. <property name=”password” value=”crm_aep”/>  
    25. </bean>  
    26.   
    27. <bean id=”dataSourceB” class=”org.enhydra.jdbc.pool.StandardXAPoolDataSource”  
    28. destroy-method=”shutdown”>  
    29. <property name=”dataSource”>  
    30. <bean class=”org.enhydra.jdbc.standard.StandardXADataSource” destroy-method=”shutdown”>  
    31. <property name=”transactionManager” ref=”jotm”/>  
    32. <property name=”driverName” value=”oracle.jdbc.driver.OracleDriver”/>  
    33. <property name=”url” value=”jdbc:oracle:thin:@10.2.226.24:1521:voucher”/>  
    34. </bean>  
    35. </property>  
    36. <property name=”user” value=”boss”/>  
    37. <property name=”password” value=”boss”/>  
    38. </bean>  
    39.   
    40. <tx:annotation-driven transaction-manager=”txManager” proxy-target-class=”true” />  
    41.   
    42. <!– 第一个数据库的sqlMapClient –>  
    43. <bean id=”sqlMapClient1″ class=”org.springframework.orm.ibatis.SqlMapClientFactoryBean”>  
    44. <property name=”configLocation”>  
    45. <!– 包含第一个数据库表的map –>  
    46. <value>classpath:SqlMapConfig_ora1.xml</value>  
    47. </property>  
    48. <property name=”dataSource” ref=”dataSourceA” />  
    49. </bean>  
    50. <!– 第二个数据库的sqlMapClient –>  
    51. <bean id=”sqlMapClient2″ class=”org.springframework.orm.ibatis.SqlMapClientFactoryBean”>  
    52. <property name=”configLocation”>  
    53. <!– 包含第一个数据库表的map –>  
    54. <value>classpath:SqlMapConfig_ora2.xml</value>  
    55. </property>  
    56. <property name=”dataSource” ref=”dataSourceB” />  
    57. </bean>  
    58.   
    59. <bean id=”product1Dao” class=”com.crm.code.dao.impl.Product1DaoImpl”>  
    60. <property name=”sqlMapClient”>  
    61. <ref bean=”sqlMapClient1″/>  
    62. </property>  
    63. </bean>  
    64. <bean id=”product2Dao” class=”com.crm.code.dao.impl.Product2DaoImpl”>  
    65. <property name=”sqlMapClient”>  
    66. <ref bean=”sqlMapClient2″/>  
    67. </property>  
    68. </bean>  
    69. <bean id=”product12Service” class=”com.crm.code.service.impl.Product12ServiceImpl”>  
    70. <property name=”product1Dao”>  
    71. <ref bean=”product1Dao” />  
    72. </property>  
    73. <property name=”product2Dao”>  
    74. <ref bean=”product2Dao” />  
    75. </property>  
    76. </bean>  
    77. </beans>  

      

  • 相关阅读:
    二分图的最大匹配
    染色法判定二分图
    kruskal求最小生成树
    prim算法求最小生成树
    floyd
    spfa算法
    bellman_ford
    Dijkstra
    文件操作_1-18 选择题
    会话控制_2-5 编程练习
  • 原文地址:https://www.cnblogs.com/chenzhao/p/2580912.html
Copyright © 2020-2023  润新知