Grails - 禁止访问org.hibernate.cfg.Environment错误

时间:2016-02-03 15:46:04

标签: hibernate postgresql grails

环境

Grails 2.4.4
PostgreSQL 9.4
JDK 1.7

我正试图让Grails Database Reverse Engineer Plugin工作。我经历了一些错误,现在我遇到了这些错误。 我是新手,对hibernate不太熟悉。我该怎么做才能解决这些错误?我试图添加hibernate.properties文件,但这不起作用。 (我不确定我做得对吗......)

/Grails_Workspace/dbTest/target/work/plugins/db-reverse-engineer-4.0.0/src/groovy/grails/plugin/reveng/Reenigne.groovy: 92: Access to org.hibernate.cfg.Environment#DRIVER is forbidden @ line 92, column 14.
        properties[Environment.DRIVER] = driverClass
.               ^
.    
Access to org.hibernate.cfg.Environment#PASS is forbidden @ line 93, column 14.
        properties[Environment.PASS] = password
.               ^
.    
Access to org.hibernate.cfg.Environment#URL is forbidden @ line 94, column 14.
        properties[Environment.URL] = url
.               ^
.    
Access to org.hibernate.cfg.Environment#USER is forbidden @ line 95, column 14.
        properties[Environment.USER] = username
.               ^
.    
Access to org.hibernate.cfg.Environment#DIALECT is forbidden @ line 97, column 15.
            properties[Environment.DIALECT] = dialect
.                ^
.    
Access to org.hibernate.cfg.Environment#DEFAULT_SCHEMA is forbidden @ line 100, column 15.
            properties[Environment.DEFAULT_SCHEMA] = defaultSchema
.                ^
.    
Access to org.hibernate.cfg.Environment#DEFAULT_CATALOG is forbidden @ line 103, column 15.
            properties[Environment.DEFAULT_CATALOG] = defaultCatalog
                 ^

感谢您的帮助。

修改

插件块

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

    // plugins for the compile step
    compile ":scaffolding:2.1.2"
    compile ":asset-pipeline:1.9.9"
    compile ":postgresql-extensions:4.6.1"
    compile ":joda-time:1.5"
    compile ":db-reverse-engineer:4.0.0"

    // plugins needed at runtime but not for compilation
    runtime ":hibernate4:4.3.6.1" // or ":hibernate:3.6.10.18"
    runtime ":database-migration:1.4.0"
    runtime ":jquery:1.11.1"

    // Uncomment these to enable additional asset-pipeline capabilities
    //compile ":sass-asset-pipeline:1.9.0"
    //compile ":less-asset-pipeline:1.10.0"
    //compile ":coffee-asset-pipeline:1.8.0"
    //compile ":handlebars-asset-pipeline:1.3.0.3"
}

1 个答案:

答案 0 :(得分:2)

有同样的问题。我使用3.0.0

使用

compile ":db-reverse-engineer:3.0.0"
remove 
runtime ":db-reverse-engineer:4.0.0"