Springboot2.0中jpa默认创建的mysql表为myisam引擎问题

使用Springboot2.0后,使用jpa操作mysql数据库时,默认创建的表的引擎是myisam,myisam是不能加外键的,找了一些资源,最终可以用此方法解决!

yml格式:

spring:
  jpa:
    database: mysql
    show-sql: true
    hibernate:
      ddl-auto: update
      naming:
        physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect  #不加这句则默认为myisam引擎

properties格式:

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL55Dialect

 

posted @ 2018-10-30 10:28  林深时见鹿!  阅读(610)  评论(0编辑  收藏  举报
博客已稳定运行: