Change database schema used by Spring Boot
spring.jpa.properties.hibernate.default_schema=your_scheme
OR
spring: jpa: properties: hibernate.default_schema: your_scheme
With HikariDataSource for example spring.jpa.properties.hibernate.default_schema is ignored and you have to set too
spring.datasource.hikari.schema=your_scheme
spring:
jpa:
properties:
hibernate:
default_schema: your_schema_name
Use for application.properties
:
spring.jpa.properties.hibernate.default_schema=your_scheme
OR for application.yaml
:
spring:
jpa:
properties:
hibernate.default_schema: your_scheme
From the Spring Boot reference guide:
all properties in
spring.jpa.properties.*
are passed through as normal JPA properties (with the prefix stripped) when the localEntityManagerFactory
is created
See http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-configure-jpa-properties
For a full list of available properties see http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-configure-jpa-properties
It depends on the DataSource implementation which property has to be used to set the default schema (reference). With HikariDataSource for example spring.jpa.properties.hibernate.default_schema
is ignored and you have to set
spring.datasource.hikari.schema=schema
See the complete list of HikariCP configuration parameters here.