亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

Spring+jta+Hibernate的跨庫(kù)處理的配置

系統(tǒng) 1938 0

配置文件如下: ( 對(duì)應(yīng)的表的引擎要是 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" >

???

??? <!-- 數(shù)據(jù)源 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 >

??? <!-- 數(shù)據(jù)源 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 事務(wù)管理器 -->

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

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

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

??? </ bean >

???

??? <!-- 第一個(gè) sessionFactory ,有多少個(gè)數(shù)據(jù)庫(kù)就要有多少個(gè)數(shù)據(jù)源,也就要有多少個(gè) sessionFactory ,每個(gè) sessionFactory 對(duì)應(yīng)一個(gè)數(shù)據(jù)源 -->

??? < 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 > ??

分享到:
評(píng)論

Spring+jta+Hibernate的跨庫(kù)處理的配置


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

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

【本文對(duì)您有幫助就好】

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 精品视频一区二区三三区四区 | 2023中文字幕在线观看 | 日本一区二区三区在线播放 | 久久我们这里只有精品国产4 | 中国一级特黄真人毛片免 | 国产日韩美国成人 | 国产一级特黄高清在线大片 | 亚洲美女视频在线观看 | 青青久久99久久99久久999 | 再猛点深使劲爽日本免费视频 | 久久一二| 香蕉尹人综合精品 | 完整日本特级毛片 | 欧美亚洲图片 | 欧美成人天天综合天天在线 | 一级s片 | 狠狠躁夜夜躁人人爽天天不 | 亚洲精品乱码久久久久久中文字幕 | 日本99视频| 呦女亚洲一区精品 | 国产成人综合亚洲亚洲欧美 | 四虎永久网址 | 国产成人亚洲精品 | 麻豆日韩区久久综合 | 国产高清一区二区三区四区 | 能免费看黄的网站 | 国产欧美一级片 | 亚洲最大视频网 | 99亚洲精品高清一二区 | 久久91精品综合国产首页 | 色婷婷资源网 | 毛片免费全部播放一级 | 国产成人亚洲欧美三区综合 | 97se亚洲综合自在线尤物 | 日本免费成人网 | www欧美| 久久久精品波多野结衣 | 欧美一级黄色录像 | 狠狠色丁香婷婷综合久久片 | 免费爱爱视频网站 | 99re7在线精品免费视频 |