gpt4 book ai didi

hibernate - 如何在 Grails 3.0.1 中设置 hibernate 方言

转载 作者:行者123 更新时间:2023-12-02 11:27:10 25 4
gpt4 key购买 nike

我正在尝试新的 Grails 3 堆栈,但在 gorm/hibernate 方面遇到了障碍。我有一个自定义的 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 似乎从未被实例化,并且 gorm 在尝试创建数据库时抛出以下错误:

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

类型 90001 是方言应处理的 JDBC 类型代码之一。

这段代码和设置在我从事的 Grails 2.x.y 项目中运行良好。

如何在 Grails 3.0.1 中设置 hibernate 方言?

最佳答案

这似乎是 Grails 3.0.1 的一个已知问题,并且有一个关于它的开放错误报告:

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

当前的解决方法是在 application.yml 文件的 hibernate 部分设置方言:

hibernate:
dialect: "our.namespace.Dialect"

关于hibernate - 如何在 Grails 3.0.1 中设置 hibernate 方言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30237315/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com