Spring boot jpa @Column命名大小写问题,
2020-09-17 本文已影响0人
Mark_ZSQ
一、问题
驼峰命名会被自动转成数据库下划线命名,指定@Column的name也不起作用
@Column(nullable = false,name = "resolvedDate")
private Timestamp resolvedDate;
resolvedDate会被转成resolved_date
二、解决方案
添加命名规则
在application.properties添加jpa属性:
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl