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

版权声明:本文为博主原创文章,未经博主允许不得转载! https://blog.csdn.net/qq_39539575/article/details/83537835

使用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

猜你喜欢

转载自blog.csdn.net/qq_39539575/article/details/83537835
今日推荐