spring 手动抛异常并让事务回滚

    try
    {
      throw new Exception("test exception!");
    }
    catch ( Exception e )
    {
      e.printStackTrace();
      TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //事务回滚
    }

猜你喜欢

转载自blog.csdn.net/wessiyear/article/details/80015802