- 浏览: 1449334 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (691)
- linux (207)
- shell (33)
- java (42)
- 其他 (22)
- javascript (33)
- cloud (16)
- python (33)
- c (48)
- sql (12)
- 工具 (6)
- 缓存 (16)
- ubuntu (7)
- perl (3)
- lua (2)
- 超级有用 (2)
- 服务器 (2)
- mac (22)
- nginx (34)
- php (2)
- 内核 (2)
- gdb (13)
- ICTCLAS (2)
- mac android (0)
- unix (1)
- android (1)
- vim (1)
- epoll (1)
- ios (21)
- mysql (3)
- systemtap (1)
- 算法 (2)
- 汇编 (2)
- arm (3)
- 我的数据结构 (8)
- websocket (12)
- hadoop (5)
- thrift (2)
- hbase (1)
- graphviz (1)
- redis (1)
- raspberry (2)
- qemu (31)
- opencv (4)
- socket (1)
- opengl (1)
- ibeacons (1)
- emacs (6)
- openstack (24)
- docker (1)
- webrtc (11)
- angularjs (2)
- neutron (23)
- jslinux (18)
- 网络 (13)
- tap (9)
- tensorflow (8)
- nlu (4)
- asm.js (5)
- sip (3)
- xl2tp (5)
- conda (1)
- emscripten (6)
- ffmpeg (10)
- srt (1)
- wasm (5)
- bert (3)
- kaldi (4)
- 知识图谱 (1)
最新评论
-
wahahachuang8:
我喜欢代码简洁易读,服务稳定的推送服务,前段时间研究了一下go ...
websocket的helloworld -
q114687576:
http://www.blue-zero.com/WebSoc ...
websocket的helloworld -
zhaoyanzimm:
感谢您的分享,给我提供了很大的帮助,在使用过程中发现了一个问题 ...
nginx的helloworld模块的helloworld -
haoningabc:
leebyte 写道太NB了,期待早日用上Killinux!么 ...
qemu+emacs+gdb调试内核 -
leebyte:
太NB了,期待早日用上Killinux!
qemu+emacs+gdb调试内核
下载AtomikosTransactionsEssentials-3.7.0M5-bin.zip
ojdbc14.jar,mysql-connector-java-5.0.8-bin.jar,spring.jar(2.0),log4j-1.2.14.jar,commons-logging.jar
工程类似,其实不是web工程
import.xml
jta.properties
ojdbc14.jar,mysql-connector-java-5.0.8-bin.jar,spring.jar(2.0),log4j-1.2.14.jar,commons-logging.jar
工程类似,其实不是web工程
import.xml
<?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="mysqlDS" class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close"> <description>mysql xa datasource</description> <property name="uniqueResourceName"> <value>mysql_ds</value> </property> <property name="xaDataSourceClassName"> <value>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</value> </property> <property name="xaProperties"> <props> <prop key="user">root</prop> <prop key="password">haoning</prop> <prop key="URL">jdbc:mysql://localhost:3306/test</prop> </props> </property> </bean> <bean id="oracleDS" class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close"> <description>oracle xa datasource</description> <property name="uniqueResourceName"> <value>oracle_ds</value> </property> <property name="xaDataSourceClassName"> <value>oracle.jdbc.xa.client.OracleXADataSource</value> </property> <property name="xaProperties"> <props> <prop key="user">UNIFLOW</prop> <prop key="password">UNIFLOW</prop> <prop key="URL">jdbc:oracle:thin:@10.4.120.126:1521:E4CS</prop> </props> </property> </bean> <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp"> <description>UserTransactionImp</description> <property name="transactionTimeout" value="300"/> </bean> <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close"> <description>UserTransactionManager</description> <property name="forceShutdown"> <value>true</value> </property> </bean> <bean id="springTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <description>JtaTransactionManager</description> <property name="transactionManager"> <ref bean="atomikosTransactionManager" /> </property> <property name="userTransaction"> <ref bean="atomikosUserTransaction" /> </property> </bean> <bean id="transactionProxyFactoryBean" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true"> <property name="transactionManager"> <ref bean="springTransactionManager" /> </property> <property name="transactionAttributes"> <props> <prop key="insert*">PROPAGATION_REQUIRED,-Exception</prop> </props> </property> </bean> <bean id="helloDao" class="com.jta.HelloDaoImpl"> <property name="dataSource" ref="mysqlDS" /> </bean> <bean id="worldDao" class="com.jta.WorldDaoImpl"> <property name="dataSource" ref="oracleDS" /> </bean> <bean id="helloBiz" class="com.jta.HelloBizImpl"> <property name="helloDao" ref="helloDao" /> <property name="worldDao" ref="worldDao" /> </bean> <bean id="helloBizProxy" parent="transactionProxyFactoryBean"> <property name="target"> <ref bean="helloBiz" /> </property> </bean> </beans>
jta.properties
com.atomikos.icatch.service=com.atomikos.icatch.standalone.UserTransactionServiceFactory com.atomikos.icatch.console_file_name = tm.out com.atomikos.icatch.log_base_name = tmlog com.atomikos.icatch.tm_unique_name = com.atomikos.spring.jdbc.tm com.atomikos.icatch.console_log_level = INFO
package com.jta; public interface HelloBiz { public void insertTwoDatabase() throws Exception; } package com.jta; public class HelloBizImpl implements HelloBiz { private HelloDao helloDao; private WorldDao worldDao; public void insertTwoDatabase() throws Exception{ this.getHelloDao().addHello();//mysql this.getWorldDao().addWorld();//oracle } public HelloDao getHelloDao() { return helloDao; } public void setHelloDao(HelloDao helloDao) { this.helloDao = helloDao; } public WorldDao getWorldDao() { return worldDao; } public void setWorldDao(WorldDao worldDao) { this.worldDao = worldDao; } } package com.jta; public interface HelloDao { public void addHello() throws Exception; } package com.jta; import org.springframework.jdbc.core.support.JdbcDaoSupport; public class HelloDaoImpl extends JdbcDaoSupport implements HelloDao{ public void addHello() throws Exception{//mysql String sql = "insert into user(name,age) values(?,?)"; Object[] params = new Object[]{"test","12"}; this.getJdbcTemplate().update(sql, params); } } package com.jta; public interface WorldDao { public void addWorld() throws Exception; } package com.jta; import org.springframework.jdbc.core.support.JdbcDaoSupport; public class WorldDaoImpl extends JdbcDaoSupport implements WorldDao { public void addWorld() throws Exception {// oracle String sql = "insert into test1(id,myname) values(?,?)"; Object[] params = new Object[] { 3, "ningge" }; this.getJdbcTemplate().update(sql, params); } } package com.jta; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class Test { public static void main(String[] args)throws Exception{ ApplicationContext context=new ClassPathXmlApplicationContext("import.xml"); HelloBiz helloBiz=(HelloBiz)context.getBean("helloBizProxy"); helloBiz.insertTwoDatabase(); } }
评论
2 楼
onlyor
2012-03-31
public void saveBoth(Student s, User u) throws Exception {
userDao.save(u);
studentDao.save(s);
throw new Exception();
}
我测试了,到保存了。。。。
userDao.save(u);
studentDao.save(s);
throw new Exception();
}
我测试了,到保存了。。。。
1 楼
风之狐
2011-02-24
不错,正在关注这个
发表评论
-
tomcat的https的例子
2016-09-22 17:50 433参考http://jingyan.baidu.com/arti ... -
jpa
2014-11-25 20:14 548可以使用jpa生成数据库表 import javax.pe ... -
hadoop复习 1搭建
2014-07-23 17:38 757参考http://hadoop.apache.org/docs ... -
jspwebshell
2014-06-20 12:35 6693<%@ page contentType=" ... -
jvm总结
2013-03-04 19:02 1711分代 年轻代: 所有新生 ... -
java的upload
2013-01-24 19:31 1934好久没写java的东西了 遇到个服务器,不是标准的httpSe ... -
spring lucene rmi例子
2012-09-18 16:24 1876http://www.blogjava.net/freeman ... -
jna的使用
2012-04-22 21:06 2837遇到java调用共享内存的 ... -
hessian
2012-04-10 10:40 893http://hessian.caucho.com/ 这个好 ... -
jvm调优应该知道的一点东西
2012-02-27 18:13 1237概念 概念 Java 工具 jsta ... -
java socket备份
2012-02-22 10:01 1032package org.hao; import java ... -
java操作内存
2011-12-29 00:57 5140How To Write Directly to a Memo ... -
单例模式7中
2011-12-28 09:56 889package com.sohu.zookeeper; // ... -
jprofiler6远程resin
2011-07-07 23:17 2669网上找的破解码:L-Larry_Lau@163.com#784 ... -
eclipse不装插件配置resin,可以debug
2011-06-27 23:41 1809新建java工程 1.目录如下 G:. ├─.settings ... -
session所有信息
2011-06-07 11:32 767转载http://www.99inf.net/Software ... -
看端口号用netstat -abn
2011-05-14 00:27 1268张孝祥讲过个fport,到哪都依赖他看端口被什么占用, 原来n ... -
hessian的helloworld
2011-05-12 11:02 1169参考http://hessian.caucho.com/#Ex ... -
resin日志
2011-05-03 14:40 1432resin-pro-3.1.9\conf\resin.conf ... -
maven-resin
2011-05-02 22:39 2316关于resin http://2hei.net/mt/2008 ...
相关推荐
spring 3.2+ hibernate 3.* +atomikos3.9 配置多数据源 包含所有jar包和源代码,完整项目
测试atomikos spring activemq jta oracle 为了最大限度地恢复和关闭/重启能力,强烈建议您使用以下 init 依赖项配置 Spring 配置: 使事务管理器依赖于您所有的 JDBC 和 JMS 连接工厂:这可确保在关闭期间事务管理...
atomikos-Spring-Mybatis(Oracle,Mysql)
spring+mybatis+atomikos配置文件及相关包
NULL 博文链接:https://tws502934462.iteye.com/blog/1186912
spring + JTA + atomikos实现分布式事务, 高大上的技术
spring+druid+AtomikosDataSource实现多数据源切换及分布式事务控制
这项目基于数据库oracle和mysql搭建的
spring 3.2+ jpa 1.1+ atomikos3.9 配置mysql+sqlserver2000多数据源 包含所需所有jar包,完整项目
使用spring + atomikos+druid配置的分布式事务demo,两种数据源配置方式都可以,使用junit测试没问题,案例中使用的mysql数据库是8.0.11版本,版本不同请自行修改pom.xml和jdbc.properties
spring+mybatis+atomikos配置所需包跟配置文件
spring+mybatis+atomikos配置文件及相关包
基于若依项目改造的多模块分布式事务,使用了atomikos进行分布式事务的管理。
将基于Spring4.1.7+atomikos+mybaits 实现两阶段的分布式事务处理,通过AOP面向切面实现动态实现数据源的切换 http://www.dczou.com/viemall/407.html
spring+hibernate+atomikos实现多数据源分布式事务管理
多数据源,实现分布式事务管理,基于Spring+SpringMVC+MyBatis+Atomikos框架
spring+druid+atomikos分布式事务,多数据源切换!其中包括配置文件
spring+mybatis+atomikos配置文件及相关包.rar
atomikos-util-4.0.6.jar,transactions-4.0.6.jar,transactions-api-4.0.6.jar,transactions-jdbc-4.0.6.jar,transactions-jta-4.0.6.jar,文档,示例
atomikos jar,spring 分布式事务提交框架