簡體   English   中英

Grails 2.5.0 + mongo +休眠

[英]Grails 2.5.0 + mongo + hibernate

我試圖將休眠與mongo驅動程序一起使用,並遇到一些問題:

我使用grails 2.5.0創建了全新的grails應用。 將dataSource.groovy更改為指向mysql,未注釋的mysql-connector-java:5.1.29,一切正常。

但是,當我在Build Config的插件部分中添加編譯“ org.grails.plugins:mongodb:5.0.0.RC1”時 ,我會在啟動時得到此信息:

| Error 2016-02-22 14:32:29,439 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing the application: org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.evaluateMapping

我錯過了什么?

NB! 應用程序無法啟動,因此所有內部映射此時都無關緊要。

這是我的配置文件:

數據源-> https://cldup.com/GnXUJDOy0b.txt

BuildConfig-> https://cldup.com/xtk5l1F_BW.txt

錯誤-> https://cldup.com/NJ7vpoX3Kb.txt

如果顯示更多代碼,但似乎沒有在域類定義中設置mongo的映射,則可能會很有用:

static mapWith="mongo"

在這里您可以找到有關此的有用教程

經過數天的搜索后,我找不到使mongodb 5.0.1正常工作的方法。 此解決方案有效。

plugins {
    compile (":mongodb:3.0.2") {
        excludes 'grails-datastore-gorm-plugin-support'
        excludes 'grails-datastore-gorm'
        excludes 'grails-datastore-core'
    }
}

然后在依賴項中,將正確的項拉入:

dependencies {
    compile 'org.grails:grails-datastore-gorm-plugin-support:3.1.3.RELEASE'
    compile 'org.grails:grails-datastore-gorm:3.1.3.RELEASE'
    compile 'org.grails:grails-datastore-core:3.1.3.RELEASE'
}

從這里無法安裝Grails MongoDB插件

希望這可以節省某人大量的時間和精力。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM