我在我的服务类中有方法。在Spring的@Transactional注解的方法中引发和未捕获的未经检查的异常是否仍会导致事务回滚?
@Transactional
public void serviceMethod {
dao.daoMethod();
}
public void daoMethod() {//dao.daoMethod
//some code
try {
//some more code that throws an unchecked exception
} catch(Exception exception) {
//do something -- no exceptions generated/thrown from here
}
//some more code
}
这会导致交易回滚吗? 如果从try块中调用的方法中抛出Unchecked异常,它会有什么不同吗?
嘿Haroldo, 感谢您的回答,以及它背后的解释。我会深入研究它。 – sarkardebanjan