Grails 1.0.3 升级问题 [英] Grails 1.0.3 Upgrade Problems

查看:13
本文介绍了Grails 1.0.3 升级问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 Grails 1.0.3 项目升级到 1.3.7,并且遇到了我认为相关的问题.

I am trying to upgrade a Grails 1.0.3 project to 1.3.7 and am having what I believe are related issues.

旧项目在 conf/hibernate/Domain1.hbm.xml 中有 Hibernate xml 文件我猜 GORM 在 1.0.3 中不存在?

The old project has Hibernate xml files in conf/hibernate/Domain1.hbm.xml I am guessing that GORM didn't exist in 1.0.3?

我是否需要将 xml 文件中的内容本质上转换为域中的域类中的 Groovy 代码/

Do I need to essentially convert what is in the xml files into Groovy code in the Domain classes in domain/

任何其他细节都有帮助.谢谢.

Any other details are helpful. Thanks.

更新-

所有这些更改都是 org.hibernate.DuplicateMappingException 的结果,看起来我只能移动域文件:相关帖子 这真的是我想要做的吗?我的理解是,使用 GORM 我根本不需要使用 xml 文件.

All of these changes are the result of a org.hibernate.DuplicateMappingException It looks like I can just move the domain files: Relevant Post Is that really what I want to do though? My understanding is that with GORM I wouldn't need to use the xml files at all.

这里有一个例外

2011-05-29 16:43:49,616 [main] ERROR context.GrailsContextLoader  - Error executing bootstraps: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is 

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.DuplicateMappingException: Duplicate class/entity mapping sportsdb.Event
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.DuplicateMappingException: Duplicate class/entity mapping sportsdb.Event
        at org.grails.tomcat.InlineExplodedTomcatServer.doStart(InlineExplodedTomcatServer.groovy:112)
        at org.grails.tomcat.InlineExplodedTomcatServer$doStart.callCurrent(Unknown Source)
        at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:97)
        at grails.web.container.EmbeddableServer$start.call(Unknown Source)
        at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158)
        at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy)
        at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
        at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
        at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149)
        at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy)
        at _GrailsRun_groovy.runInline(_GrailsRun_groovy:116)
        at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
        at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59)
        at RunApp$_run_closure1.doCall(RunApp:33)
        at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
        at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
        at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
        at gant.Gant.withBuildListeners(Gant.groovy:427)
        at gant.Gant.this$2$withBuildListeners(Gant.groovy)
        at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
        at gant.Gant.dispatch(Gant.groovy:415)
        at gant.Gant.this$2$dispatch(Gant.groovy)
        at gant.Gant.invokeMethod(Gant.groovy)
        at gant.Gant.executeTargets(Gant.groovy:590)
        at gant.Gant.executeTargets(Gant.groovy:589)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.DuplicateMappingException: Duplicate class/entity mapping sportsdb.Event
        ... 25 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.DuplicateMappingException: Duplicate class/entity mapping sportsdb.Event
        ... 25 more
    Caused by: org.hibernate.DuplicateMappingException: Duplicate class/entity mapping sportsdb.Event
        ... 25 more

推荐答案

Grails 1.0.3 中肯定存在 GORM.

GORM certainly existed in Grails 1.0.3.

您可能只需要更新 1.3.7 的休眠配置.看看 Grails 和 Hibernate - 参考文档

You'll probably just have to update your hibernate configuration for 1.3.7. Take a look at the Grails and Hibernate - Reference Documentation

除非您要映射到遗留或其他不寻常的数据库架构,否则标准 GORM 域建模是可行的方法.它非常灵活.

Unless you are mapping to a legacy or otherwise unusual database schema the standard GORM domain modelling is the way to go. It's very flexible.

这篇关于Grails 1.0.3 升级问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆