@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");
}
}
子Transactional捕获RuntimeException并回滚
我在父母中称孩子为子,可以捕获此RuntimeException吗?