java - @Transactional 回滚后是否继续抛出catch异常
问题描述
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = {
Exception.class,
RuntimeException.class
})
public void parent() {
try {
child();
} catch (RuntimeException re) {
//i want do something at here, how to catch the child RuntimeException
//child Transactional cath RuntimeException,can i catch it here?
}
}
@Transactional(propagation = Propagation.MANDATORY, rollbackFor = {
Exception.class,
RuntimeException.class
})
public void child() {
try {
xxxMapper.update();
} catch (Exception e) {
throw new RuntimeException("false");
}
}
子事务捕获 RuntimeException 并回滚
我打电话给父母的孩子,我能抓住这个 RuntimeException 吗?
解决方案
推荐阅读
- python - 水平连接数据帧
- java - Angular 和 Spring 启动:请求的资源上不存在“Access-Control-Allow-Origin”标头。如何通过角度和弹簧靴解决它
- c++ - 程序展示已售出超过 500 个茶包的茶叶品牌 C++
- typescript - 打字稿嵌套泛型
- java - Spring WebClient 中带有 json 模式 URL 参数的 ContentType 标头
- python-3.x - 从 git repo 临时下载文件 - 留下孤立的 git 进程
- kotlin - 如何在没有元组的情况下映射2个值
- python - Python Jupyter _NameError:未定义名称“数据”_即使数据已定义
- javascript - 为什么从 Jquery html() 创建的输入文本不能在 $_POST 中使用
- mysql - 根据日期和 ID 计算每年和每月的记录