spring手动回滚事务

xiaoxiao2021-03-01  37

@Transactional(rollbackFor = { Exception.class }) public String methods() { String str = "-----------"; try { doSomethings...... } catch (Exception e) { logger.error("e.getMessage()", e); //手动开启事务回滚 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); } return str; }

 

转载请注明原文地址: https://www.6miu.com/read-4200335.html

最新回复(0)