我正在将 @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)