mikuriya

@Transactional注解事务手动回滚

@Transactional(rollbackFor = Exception.class)
public void rollbackTransactional() {
    try {
        //- xxx
    } catch (Exception e) {
        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚事务
        e.printStackTrace();
    }
}

mikuriya,偶遇良缘。

posted on 2021-02-22 11:19  mikuriya  阅读(482)  评论(0编辑  收藏  举报

导航