如何指定 Spring Boot 使用的数据库架构?我正在使用默认的休眠(=默认)和 postgres(但我希望有一个通用的解决方案)。我知道如何指定 JDBC URL:
spring.datasource.url=jdbc:postgresql:db_name
但不幸的是,postgresql 不允许在 JDBC URL 中指定模式。我知道有休眠属性 hibernate.default_schema
,所以我希望以下属性之一可以工作:
hibernate.default_schema=schema
spring.hibernate.default_schema=schema
spring.jpa.hibernate.default_schema=raw_page
但不幸的是,他们俩似乎都没有任何结果。
原文由 Paperback Writer 发布,翻译遵循 CC BY-SA 4.0 许可协议
用于
application.properties
:或者对于
application.yaml
:来自 Spring Boot 参考指南:
请参阅 http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-configure-jpa-properties
有关可用属性的完整列表,请参阅 http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-configure-jpa-properties