Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
114 views
in Technique[技术] by (71.8m points)

一个方法,有两个数据源(dataSource),应该如何控制事务

大致代码如下

    @Transactional
    public void AAA(){
          从A数据库查数据(MYSQL)
          插入B数据库(ORACLE)
          更改A数据库状态(MYSQL)
          throw new RuntimeException("测试插入事务");
    }


spring.xml配了两个事务管理,结果只有A回滚了,B没有回滚,应该如何在同一个方法里把两个事务都应用呢


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

建议百度,aop事务失效原因。具体的细节要涉及到aop源码,找找相关的文章,研究一下就明白了


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...