I have to use table and column names in my Postgres that contain uppercase and lowercase letters. For example OrgInfo
I would like to create such tables and columns using Hibernate. If I use standard approach:
@Entity
@Table(name = "OrgInfo")
then I receive the table with the name "org_info".
How I can configure Hibernate to create tables and columns with exact given names including uppercase and lowercase letters?
I have tried to use
@Entity
@Table(name = "\"OrgInfo\"")
with no effect.
Also I use Spring Boot and have tried to configure like this:
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.DefaultNamingStrategy OR spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
Try to configure Hibernate "physical-strategy" in your configuration file as follows:
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
The working solution is to use both parts:
@Entity
@Table(name = "\"OrgInfo\"")
and
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With