hibernate - Grails 2.4.4 + 可搜索 :0. 6.9 运行时问题

标签 hibernate grails searchable searchable-plugin

当尝试在 Grails 2.4.4 应用程序上添加 searchable:0.6.9 (或更少的)时,我收到 hibernate4 抛出的异常,但这仅在我添加“static searchable = true”到我的域类。

考虑到我的 BuildConfig.groovy 看起来像这样:

repositories {
    inherits true // Whether to inherit repository definitions from plugins

    grailsPlugins()
    grailsHome()
    mavenLocal()
    grailsCentral()
    mavenCentral()

    mavenRepo "https://repo.grails.org/grails/core"
    mavenRepo "https://oss.sonatype.org/content/repositories/releases/"
    mavenRepo "http://repo.spring.io/milestone"

}

dependencies {

    compile "org.compass-project:compass:2.2.1"
    compile('org.apache.lucene:lucene-highlighter:4.10.2',
              'org.apache.lucene:lucene-spellchecker:3.6.2')

    test "org.grails:grails-datastore-test-support:1.0.2-grails-2.4"
    compile "javax.validation:validation-api:1.1.0.Final"
    runtime "org.hibernate:hibernate-validator:5.0.3.Final"
}

plugins {
    // plugins for the build system only
    build ":tomcat:7.0.55"

    // plugins for the compile step
    compile ":scaffolding:2.1.2"
    compile ':cache:1.1.8'
    compile ":asset-pipeline:1.9.9"

    runtime ":hibernate4:4.3.6.1" // or ":hibernate:3.6.10.18"
    runtime ":database-migration:1.4.0"
    runtime ":jquery:1.11.1"
    runtime ":searchable:0.6.9"
}

我得到这个异常:

错误 context.GrailsContextLoaderListener - 初始化应用程序时出错:org/hibernate/impl/SessionFactoryImpl 消息:org/hibernate/impl/SessionFactoryImpl 线路|方法 ->> 95 | org.compass.gps.device.hibernate.lifecycle.DefaultHibernateEntityLifecycleInjector 中的jectLifecycle 147 org.compass.gps.device.hibernate.HibernateGpsDevice 中的 doStart

有人知道如何让事情发挥作用吗?

最佳答案

我认为可搜索插件不适用于 Hibernate 4,但您尚未声明对 任何 版本的 Hibernate 的依赖,这肯定无法工作。

在我的 Grails 2.4.4 应用程序中,我使用以下版本的 Hibernate 插件进行搜索

plugins {
    runtime ':hibernate:3.6.10.18'
    // other plugins
}

关于hibernate - Grails 2.4.4 + 可搜索 :0. 6.9 运行时问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27050416/

相关文章:

java - 将我的 hibernate 类连接到 mysql 时出现异常

grails - Grails .save()未保存关联的域

email - Groovy电子邮件客户端可在Exchange 2003和Exchange 2010上使用

spring - grails自定义验证器:强制无消息

grails - 可搜索的插件不允许创建目录

java - Spring boot - 在创建时设置动态属性

java - Hibernate IllegalArgumentException 调用 setter

java - 在 Java 代码中硬编码 Hibernate 值

laravel scout shouldBeSearchable 何时被触发

grails - 具有RAM索引的Grails可搜索插件集在部署到Cloud Foundry时丢失