Groovy / Grails工具套件连接到现有的MySQL数据库

时间:2016-01-13 11:22:58

标签: mysql grails groovy gorm

我先说这是我第一次与Grails合作。

我正在尝试连接到现有数据库,以便我可以从数据库创建域类。我已经安装了Grails数据库逆向工程插件(版本4.0.0),我使用的是Grails 2.4.4。我已按照official user guide中插件和here的步骤进行操作。

当我运行命令“-Dgrails.env = extract db-reverse-engineer”时,我收到以下错误:

[groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException:    startup failed:
[groovyc] Compile error during compilation with javac.
[groovyc] GenericResponseWrapper.java:203: error: method does not override or implement a method from a supertype
[groovyc]   @Override
[groovyc]   ^
[groovyc] PageFragmentCachingFilter.java:389: error: cannot find symbol
[groovyc]           contentType = response.getContentType();
[groovyc]                                 ^
[groovyc]   symbol:   method getContentType()
[groovyc]   location: variable response of type HttpServletResponse
[groovyc] Note: Some input files use unchecked or unsafe operations.
[groovyc] Note: Recompile with -Xlint:unchecked for details.
[groovyc] 2 errors
[groovyc] 
[groovyc] 
[groovyc] 1 error

希望我没有遗漏太多信息,请告诉我还需要提供什么。谢谢。

1 个答案:

答案 0 :(得分:1)

好的,所以为我解决的是切换到Grails数据库逆向工程插件的3.0.0版本,然后还使用了Hibernate 3.xx.我还评论了这行"编译':缓存:1.1.8'"在BuildConfig.groovy中。创建模型后,您始终可以删除注释。我希望这有助于某人!