Hibernate用postgres默认命名@Column

我正在使用数据库Postgres在spring-boot中实现一个应用程序,我想要自定义列名,即camelcase

`@Column(name = "customerId")
 private Integer customerId;
 @Column(name = "accountNumber")
 private Integer accountNumber;`

为此,我添加了所有属性

`spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.hibernate.naming.strategy=org.hibernate.cfg.DefaultNamingStrategy
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl`

我是从spring docs和StackOverflow获得的,但是每次使用这些名称创建的列名称都无法正常工作

账号 客户ID

我试图用这些代码覆盖:

public class RealNamingStrategyImpl extends SpringPhysicalNamingStrategy
    implements Serializable {

public static final PhysicalNamingStrategyStandardImpl INSTANCE = new PhysicalNamingStrategyStandardImpl();

@Override
public Identifier toPhysicalTableName(Identifier name, JdbcEnvironment context) {
    return new Identifier(name.getText(), name.isQuoted());
}

@Override
public Identifier toPhysicalColumnName(Identifier name, JdbcEnvironment context) {
    return new Identifier(name.getText(), name.isQuoted());
}

}

但是没有得到预期的结果。 有人可以帮我吗? 谢谢!

评论