【发布时间】:2020-03-18 20:59:43
【问题描述】:
如果没有在@Column 中明确定义,我如何配置 spring 在列中使用下划线?例如,如果我在这样的实体中有列:
@LastModifiedBy
private String changedBy;
我想将它映射到数据库中的物理列changed_by
我尝试使用属性 spring.jpa.hibernate.naming.physical-strategy 将其配置为 SpringPhysicalNamingStrategy 或 PhysicalNamingStrategyStandardImpl 但我总是遇到异常 ERROR: column "changedby" of relation "xxxx" does not exist
【问题讨论】:
-
SpringPhysicalNamingStrategy 可以满足您的需求。 baeldung.com/hibernate-field-naming-spring-boot
标签: spring hibernate spring-boot jpa spring-data-jpa