Spring Data with MySQL
节选自《Netkiller Spring Cloud 手札》
选择数据库表引擎
正常创建表会使用数据库默认引擎,有时数据库默认引擎并不是我们需要的,通过下面配置可以指定表引擎
# Spring boot 1.x.x
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
# Spring boot 2.0.2
spring.jpa.hibernate.use-new-id-generator-mappings=true
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
声明实体
@Entity 声明实体
声明 Class 即是数据库表
@Entity
@Table
public class Yo