小编Nav*_*lla的帖子

Spring Boot + JPA:@Transactional 注释:回滚不起作用

我正在将 @Transactional 与 spring boot 和 jpa 一起使用。但它不起作用。有人可以帮忙吗。

我的插入在 myDAO 中,它在服务类中自动装配。下面的代码是实现服务接口的服务类的方法

class MyService implements Service {

@Transactional(rollbackFor = RuntimeException.class)
    public ResponseVO createOrder(params) {
    myDAO.insertInTable1(param);
    myDAO.insertInTable2(param);//I kept wrong table name in this query such that it throws exception
         }

 }
Run Code Online (Sandbox Code Playgroud)

java spring jpa spring-boot

3
推荐指数
1
解决办法
4987
查看次数

标签 统计

java ×1

jpa ×1

spring ×1

spring-boot ×1