简体   繁体   English

如何在Grails 3.0.1中设置hibernate方言

[英]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. 我正在尝试新的Grails 3堆栈,我已经遇到了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: 我有一个自定义的hibernate方言来支持一些数据库功能,但application.yml文件中的方言设置似乎被忽略:

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: our.namespace.Dialect似乎永远不会被实例化,并且gorm在尝试创建数据库时会抛出以下错误:

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. 类型90001是方言应处理的JDBC类型代码之一。

This code and setup was working well in Grails 2.xy projects that I work on. 这个代码和设置在我工作的Grails 2.xy项目中运行良好。

How can I set the hibernate dialect in Grails 3.0.1? 如何在Grails 3.0.1中设置hibernate方言?

It appears that this is a known issue with Grails 3.0.1, and there is an open bug report on it: 看来这是Grails 3.0.1的已知问题,并且有一个开放的错误报告:

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

The current workaround is to set the dialect in the hibernate section of application.yml file: 目前的解决方法是在application.yml文件的hibernate部分设置方言:

hibernate:
    dialect: "our.namespace.Dialect"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM