AOP事务不回滚的有关问题

在使用Spring框架配置了事物之后,出现不能回滚的现象,导致数据保存出现问题,具体可以查看下面几点予以解决:

1、先确认数据库类型,看表是否采用InnoDB,mysql只有InnoDB类型表才支持事务MyISAM表类型不支持事务操作

2、spring对checked Exception(比如Exception,IOException的子类)是不回滚事务的,对RuntimeException回滚事务。可使用以下代码:

String errorMsg = "";
throw new RuntimeException(errorMsg);


猜你喜欢

转载自blog.csdn.net/u011630097/article/details/72801281
今日推荐