欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

Spring+jta+Hibernate的跨庫處理的配置

系統 2020 0

配置文件如下: ( 對應的表的引擎要是 INNODB 的才可以 )

<? xml version = "1.0" encoding = "UTF-8" ?>

< beans xmlns = "http://www.springframework.org/schema/beans"

??? ???? xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"

??? ???? xmlns:aop = "http://www.springframework.org/schema/aop"

??? ???? xmlns:tx = "http://www.springframework.org/schema/tx"

??? ???? xsi:schemaLocation = "http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

?????????? http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd

?????????? http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd" >

???

??? <!-- 數據源 1 -->

??? < bean id = "dataSource1" class = "com.atomikos.jdbc.SimpleDataSourceBean" init-method = "init" destroy-method = "close" >

??? < property name = "uniqueResourceName" > ??

??????????? < value > mysql/main </ value > ??

??????? </ property > ??

??????? < property name = "xaDataSourceClassName" > ??

??????????? <!-- 使用 Mysql XADataSource(mysql>=5.0, Connector/J>=5.0 才可以支持 XADatasource)--> ??

??????????? < value > com.mysql.jdbc.jdbc2.optional.MysqlXADataSource </ value >

??????? </ property > ??

??????? < property name = "xaDataSourceProperties" > ??

??????????? < value > URL=jdbc:mysql://localhost:3306/test?useUnicode=true &amp; characterEncoding=utf-8;user=root;password=123456 </ value > ??

??????? </ property > ?

???????? < property name = "validatingQuery" >

??????????? < value > SELECT 1 </ value > ??

??????? </ property >

??? </ bean >

??? <!-- 數據源 2 -->

??? < bean id = "dataSource2" class = "com.atomikos.jdbc.SimpleDataSourceBean" init-method = "init" destroy-method = "close" > ??

??????? < property name = "uniqueResourceName" > ??

??????????? < value > mysql/secondary </ value > ??

??????? </ property > ??

??????? < property name = "xaDataSourceClassName" > ??

??????????? <!-- 使用 Mysql XADataSource(mysql>=5.0, Connector/J>=5.0 才可以支持 XADatasource)--> ??

??????????? < value > com.mysql.jdbc.jdbc2.optional.MysqlXADataSource </ value > ??

??????? </ property >

??????? < property name = "xaDataSourceProperties" > ??

??????????? < value > URL=jdbc:mysql://localhost:3306/test2?useUnicode=true &amp; characterEncoding=utf-8;user=root;password=123456 </ value > ??

??????? </ property >

???????? < property name = "validatingQuery" >

??????????? < value > SELECT 1 </ value > ??

??????? </ property >

??? </ bean >

???

??? < bean id = "atomikosTransactionManager" class = "com.atomikos.icatch.jta.UserTransactionManager" init-method = "init" destroy-method = "close" >

??????? < property name = "forceShutdown" value = "true" />

??? </ bean >

?

? ?? < bean id = "atomikosUserTransaction" class = "com.atomikos.icatch.jta.UserTransactionImp" >

??????? < property name = "transactionTimeout" value = "300" />

??? </ bean >

???

??? <!-- JTA 事務管理器 -->

??? < bean id = "springTransactionManager" class = "org.springframework.transaction.jta.JtaTransactionManager" >

?????? < property name = "transactionManager" ref = "atomikosTransactionManager" />

?????? < property name = "userTransaction" ref = "atomikosUserTransaction" />

??? </ bean >

???

??? <!-- 第一個 sessionFactory ,有多少個數據庫就要有多少個數據源,也就要有多少個 sessionFactory ,每個 sessionFactory 對應一個數據源 -->

??? < bean id = "sessionFactory1" class = "org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" >

?????? < property name = "dataSource" ref = "dataSource1" />

?????? < property name = "annotatedClasses" >

?????????? < list >

????????????? < value > org.zsl.jta.model.User </ value >

?????????? </ list >

?????? </ property >

?????? < property name = "hibernateProperties" >

?????????? < props >

????????????? < prop key = "hibernate.dialect" > org.hibernate.dialect.MySQLDialect </ prop >

????????????? < prop key = "hibernate.show_sql" > true </ prop >

????????????? < prop key = "hibernate.hbm2ddl.auto" > update </ prop >

????????????? <!--

????????????? <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>

????????????? <prop key="hibernate.cache.use_query_cache">true</prop>

????????????? ? -->

?????????? </ props >

?????? </ property >

??? </ bean > ??

分享到:
評論

Spring+jta+Hibernate的跨庫處理的配置


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 欧美成人精品激情在线观看 | 妈妈的朋友酷客影响 | 国产精品视频免费的 | 亚洲热影院 | 欧美日韩综合一区 | 锵锵锵锵锵锵锵锵锵好大好湿软件 | 无码日韩精品一区二区免费 | 精品国产九九 | 99这里只有精品6 | 亚洲精品国产成人一区二区 | 狠狠添 | 亚洲婷婷综合中文字幕第一页 | 91精品国产91久久久 | 浮力影院网站午夜 | 色屁屁www免费看视频影院 | 女人一级毛片免费视频观看 | 免费人成在线播放 | 日日夜夜操操操 | 日本不卡视频在线观看 | 污版视频在线观看 | 爱爱视频在线观看 | 99re在线观看 | 天天干天天操天天爽 | 亚洲精品一区二区三区婷婷月色 | 久久久无码精品一区二区三区 | 五月激情网站 | 久久亚洲视频 | 国产一级特黄aa大片免费 | 嫩草影院地址一二三网址 | 99视频这里只有精品国产 | 国产高清精品一区二区三区 | 欧美成视频无需播放器 | 日本特黄aa一大片 | 韩国草草影院 | 手机看片国产免费现在观看 | 天天精品视频免费观看 | 亚洲午夜久久久久中文字幕久 | 99热久久这里只有精品2010 | 鲁丝片一区二区三区免费 | 四季久久免费一区二区三区四区 | 久热草在线 |