6

My Grails 3.3.2 application currently connecting to an Oracle 11g database and some of the data tables are synonyms with dblink that point to the physical table in another database. When the Grails application startup, below hibnerate exception was threw:

org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing column [col_in_tbl_with_synonyms] in table [tbl_with_synonyms]

Many articles say that the connection property includeSynonyms has to be set to true in order to let Oracle return the meta data so that hibernate can find the column definition. So I tried to set the includeSynonyms=true in different ways but still not getting it work and always getting above error, no matter I used ojdbc6 or ojbc8 driver.

I know I can set dbCreate: none to bypass the validation as workaround, but with validation can find out the mapping problem earlier which should be a good idea.

Below is my configuration for reference, any idea? Thanks!

build.gradle

bootRun { jvmArgs = ['-Doracle.jdbc.includeSynonyms=true'] }

application.yml

spring: ... datasource: dbProperties: includeSynonyms: true synonyms: true connectionProperties: includeSynonyms: true synonyms: true connection-properties: includeSynonyms: true synonyms: true hibernate: ... synonyms: true includeSynonyms: true dataSources: dataSource: driverClassName: oracle.jdbc.OracleDriver dialect: org.hibernate.dialect.Oracle10gDialect dbCreate: validate dbProperties: includeSynonyms: true synonyms: true connectionProperties: includeSynonyms: true synonyms: true connection-properties: includeSynonyms: true synonyms: true ... properties: ... includeSynonyms: true synonyms: true dbProperties: includeSynonyms: true synonyms: true connectionProperties: includeSynonyms: true synonyms: true connection-properties: includeSynonyms: true synonyms: true

Burt Beckwith
  • 75,342
  • 5
  • 143
  • 156
Leo
  • 142
  • 1
  • 3
  • 11
  • im having the same issue. i want "validate", but i have to set it to "none" (and everything works with none, but no ideal.). Here is a slightly different sugar syntax answer : https://stackoverflow.com/questions/60867141/how-to-set-connection-properties-includesynonyms/60867494#60867494 – granadaCoder Jun 05 '20 at 20:58

0 Answers0