再会。以下代码:
class A{
private B b;
@Transactional
public SomeResult doSomething(){
SomeResult res = null;
try {
// do something
} catch (Exception e) {
res = b.saveResult();
}
return res ;
}
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
class B{
public SomeResult saveResult(){
// save in db
}
}
据我了解,如果方法中出现异常,doSomething
则不会回滚事务。以及如何让它滚动?并返回 SomeResult