spring - JavaWeb中 Service 层的事务问题
PHP中文网
PHP中文网 2017-04-18 10:53:17
0
3
549

下面是我的Spring配置

通过上面的配置可以看出我是在所有的service中加入的事物,也就是说我的service出错了会回滚所有的提交。
那么如果遇到Aservice调用Bservice的方法,然后Bservice调用了Cservice层的方法,
A->B->C
这种情况属于事物层嵌套调用,那么问题来了我在Cservice中如果出现异常,现在是只会回滚Cservice的事物,还是会把A和B的事物都回滚。
请大牛来帮忙解释下这个问题。我也是突然想到有这种情况实际没有这么做呢~

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(3)
刘奇

I haven’t tried this. However, it is generally not recommended that service calls service. Some common ones can be placed in dao

刘奇

propagation="REQUIRED" means that if a transaction currently exists, put it into the current transaction scope, otherwise create a new transaction. So they will all belong to the same transaction.

PHPzhong

This can be defined using the propagation method of the configuration transaction. Do you want to join the current transaction or create a new transaction yourself?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template