By default, my Spring Boot project had JPA mapping entity properties to table columns by transforming the names from camelCase to snake_case (e.g. from fooBar
to foo_bar
).
I'm working on an existing DB, where the entity property names were kept as is for the table column names (e.g. from fooBar
to fooBar
), so I tried to use the @Column
annotation to explicitly specify the name:
@Column(name = "fooBar")
private String fooBar;
This wasn't working. I followed the advice given here:
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
My @Column
is now successfully taken into account, but I'm losing the camelCase to snake_case implicit transformation on the properties that don't have the @Column
the annotation.
Any idea how to transform from camelCase to snake_case by default, unless explicitly specified in the @Column
annotation?