Search code examples
hibernategrailsgrails-orm

How to set the hibernate dialect in Grails 3.0.1


I'm trying out the new Grails 3 stack and I've hit a snag with gorm / hibernate. I have a custom hibernate dialect to support some database features, but the dialect setting in the application.yml file appears to be ignored:

dataSource:
    dialect: "our.namespace.Dialect"
    pooled: true
    jmxExport: false
    driverClassName: "org.postgresql.Driver"        
    username: user
    password: password
    dbCreate: 'update'

our.namespace.Dialect never seems to be instantiated, and gorm throws the following error when attempting to create the database:

ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000299: Could not complete schema update
org.hibernate.MappingException: No Dialect mapping for JDBC type: 90001

Type 90001 is one of the JDBC type codes the dialect should be handling.

This code and setup was working well in Grails 2.x.y projects that I work on.

How can I set the hibernate dialect in Grails 3.0.1?


Solution

  • It appears that this is a known issue with Grails 3.0.1, and there is an open bug report on it:

    https://github.com/grails/grails-core/issues/614

    The current workaround is to set the dialect in the hibernate section of application.yml file:

    hibernate:
        dialect: "our.namespace.Dialect"