My DB configuration in Spring Boot is done using yaml file:
# Common
spring:
jpa:
properties:
hibernate:
show_sql: true
use_sql_comments: truecat
format_sql: false
ddl-auto: validate
synonyms: true
connection:
includeSynonyms: true
# CONNECTION_PROPERTY_INCLUDE_SYNONYMS_DEFAULT: 'true'
database: ORACLE
datasource:
tomcat:
max-active: 10
max-idle: 10
# template only
---
spring:
profiles: dev
datasource:
url: jdbc:oracle:thin:@//localhost:1521/DEV
username: DEV
password: ...
Initially I was facing
Schema-validation: missing table
So I added hibernate.synonyms=true, now I'm getting
Schema-validation: missing column
To solve that I'd need to alter connection like this https://gist.github.com/uggds/c3f0fa71037bc5177f60
Can I do that in configuration?
What I tried and didn't work
hibernate.connection.CONNECTION_PROPERTY_INCLUDE_SYNONYMS_DEFAULT: true
hibernate.connection.includeSynonyms: true
Related: DatabaseMetaData.getColumns returning an empty ResultSet for synonyms
I tried to google for that, but I found nothing...
edit:
Additional test based on M. Deinum's answer:
I strongly believe, that
spring:
jpa:
properties:
hibernate.synonyms: true
and
spring:
jpa:
properties:
hibernate:
synonyms: true
is the same, at least it had the same effect, when I used one or the other (both resulting in Schema-validation: missing column
I added
datasource:
tomcat:
max-active: 10
max-idle: 10
connection-properties:
includeSynonyms: true
but I'm getting the same error
Schema-validation: missing column
When I completely removed
spring:
jpa:
properties:
hibernate:
synonyms: true
I'm getting
Schema-validation: missing table
edit 2:
Trying setting properties on hikari connection pool
spring:
jpa:
properties:
hibernate:
show_sql: true
use_sql_comments: true
format_sql: false
ddl-auto: validate
synonyms: true
database: ORACLE
datasource:
hikari:
connection-properties:
includeSynonyms: true
I'm still getting:
missing column [zone_definitionpk_id]
Just to test, when I replace synonym with view it's fine. Also when I turn off validation it's fine. I mean the functionality works.
edit 3
Take care of connection-properties vs. datasource-properties and with synonyms the validation takes longer (at least for me).