Spring Boot + Hibernate + Postgres - not creating tables

后端 未结 1 584
陌清茗
陌清茗 2021-01-24 00:32

I am trying to generate schema tables based on entities. The application starts correctly, the SQL is generated but there is no result - none of tables are created. What\'s wron

相关标签:
1条回答
  • 2021-01-24 01:16

    I have fixed the issue. Instead of spring.datasource.schema=schemaName there should be spring.jpa.properties.hibernate.default_schema=schemaName.

    The set of necessary properties required for generating tables in my case is the following:

    spring.datasource.url = jdbc:postgresql://localhost:5432/postgres
    spring.jpa.properties.hibernate.default_schema = schemaName
    spring.datasource.username = userName
    spring.datasource.password = userPassword
    spring.jpa.hibernate.ddl-auto = create-drop
    spring.jpa.show-sql = true
    
    0 讨论(0)
提交回复
热议问题