Configure JPA to recognize uppercase Postgresql entities and tables

Asked

Viewed 60 times

-1

Recently I am working in a project that uses as DBMS Postgresql. In the database all tables and columns are in "UPPERCASE".

Example:

CUSTOMER - ID_CUSTOMER - NAME - DESC

When it comes to mapping entities, I’m using the backslash strategy:

    @Table(name = "\"CUSTOMER\"")
    public class Customer
    {
        @Id
        @GeneratedValue(strategy = IDENTITY)
        @Column(name ="\"ID_CUSTOMER\"")
        private Long idCustomer;
    }

I believe that this strategy is not the best, since in this project there are many tables and columns. They know another way to solve this problem?

Important points:

  • There is no possibility to rename tables or columns, since this is the client’s basis and we must follow his standards.

  • Our project is developed in Java 8 and Spring DATA JPA.

I appreciate any help, thank you.

1 answer

0

Maybe it is because you are using MYSQL5DIALECT, has a specific dialect for postgree, which ends up improving the naming Strategy.

spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect

I hope you solve my problem.

  • Thanks, but that’s not it. My comic settings are already like this. 
Segue minhas configurações: 


spring.datasource.password=XXX 

spring.datasource.username=XXX 

spring.jpa.hibernate.ddl-auto=none 

spring.datasource.platform=postgres 

spring.datasource.initialization-mode=always 

spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect 

spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl 

spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true

Browser other questions tagged

You are not signed in. Login or sign up in order to post.