SpringBoot 2.0.5版本使用JPA时@Transactional失效问题

版权声明:转载请注明出处 , 蟹蟹 https://blog.csdn.net/WP081600/article/details/82820695

失效原因: SpringBoot 2.0.5版本使用JPA自动创建表时,默认表引擎为MyISAM,该引擎不支持事务导致@Transactional失效.

 1. 查看已有数据表引擎

show create table 表名

  2. 修改表引擎为InnoDB

alter table 表名 engine=InnoDB

  3. 在配置文件中修改

      将spring.jpa.database-platform:设置为org.hibernate.dialect.MySQL5InnoDBDialect,后续创建的表引擎均为InnoDB

猜你喜欢

转载自blog.csdn.net/WP081600/article/details/82820695