How do I avoid 'Could not determine Hibernate dialect for database name [H2]!'?

旧巷老猫 提交于 2019-11-28 14:09:09

This was a bug in the Joda Time Plugin. See the mentioned JIRA issue for details.

jAbreu

If jdk is Java 7u25 and grails 2.2.1, may be a solution:: Grails suddenly throws error Could not determine Hibernate dialect for database name

The information that the error is fixed in grails 2.2.3 is correct. I tested it and it worked. A point to be made is (Spring loaded causes Grails to fail to bootstrap using Oracle JDK 1.7u25):

I hope you find it useful :)

I just upgraded to Grails 2.0, and was experiencing the same issue, but if I created a brand new Grails 2.0 project there were no such problems. I leave this answer for any who might be experience the same. It's important to ensure the right hibernate libraries are being used.

If like me you were upgrading an existing project, I recommend comparing the config files of your existing project with those of a brand new 2.0 project. Doing this you will see that the build config file should include a hibernate plugin:

runtime ":hibernate:$grailsVersion"

Which version of Grails are you using? I believe you are using Grails 1.3.7.

The H2Dialet has a few bugs from the Hibernate.jar which is 3.3.1 in Grails 1.3.7, it is included in Hibernate 3.5 and Grails 2.0.

My solution is, in your DataSource.groovy, use this

dialect='org.hibernate.dialect.H2DialectPatch'

and download the Java class from here : Source Code, change its class name to H2DialectPatch to avoid confusing, put it in your src/java folder.

It seems that the problem is related to the version of JDK 7 (openjdk 7u25).

Alternative is to use Ubuntu PPA for Oracle JDK: https://launchpad.net/~webupd8team/+archive/java

which worked fine for me and solved the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!