xapool

分布式事务系列(3.1)jotm的分布式案例

拥有回忆 提交于 2019-11-27 07:13:22
#1 系列目录 分布式事务系列(开篇)提出疑问和研究过程 分布式事务系列(1.1)Spring事务管理器PlatformTransactionManager源码分析 分布式事务系列(1.2)Spring事务体系 分布式事务系列(2.1)分布式事务模型与接口定义 分布式事务系列(3.1)jotm的分布式案例 分布式事务系列(3.2)jotm分布式事务源码分析 分布式事务系列(4.1)Atomikos的分布式案例 #2 与Spring集成方式使用jotm 工程代码地址: 与Spring集成方式使用jotm 先来感受下一个分布式事务的案例(使用一般的数据库驱动,不需要支持分布式XA协议): ##2.1 业务逻辑的操作 UserDao和LogDao,操作分别如下: @Repository public class UserDao { @Resource(name="jdbcTemplateA") private JdbcTemplate jdbcTemplate; public void save(User user){ jdbcTemplate.update("insert into user(name,age) values(?,?)",user.getName(),user.getAge()); } } @Repository public class LogDao {