Grails1.0.3升级问题

Grails1.0.3升级问题,grails,groovy,gorm,Grails,Groovy,Gorm,我正在尝试将Grails1.0.3项目升级到1.3.7,我认为这是相关的问题 旧项目在conf/Hibernate/Domain1.hbm.xml中有HibernateXML文件我猜GORM在1.0.3中不存在 我是否需要将xml文件中的内容转换为域中的域类中的Groovy代码/ 任何其他细节都很有用。谢谢 更新- 所有这些更改都是org.hibernate.DuplicateMappingException的结果。看起来我可以移动域文件:这真的是我想要做的吗?我的理解是,对于GORM,我根本不

我正在尝试将Grails1.0.3项目升级到1.3.7,我认为这是相关的问题

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

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

任何其他细节都很有用。谢谢

更新-

所有这些更改都是org.hibernate.DuplicateMappingException的结果。看起来我可以移动域文件:这真的是我想要做的吗?我的理解是,对于GORM,我根本不需要使用xml文件

这是一个例外

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

GORM当然存在于Grails1.0.3中

您可能只需要更新1.3.7的hibernate配置。看一看


除非您要映射到遗留的或其他不寻常的数据库模式,否则标准GORM域建模是一条可行之路。非常灵活。

@JamesA-感谢您提供的链接和信息。但是,与链接相比,HibernateXML看起来不错,所以我不确定。还有其他想法吗?@JamesA-我相信我需要HibernateXML和域对象,它们将具有扩展它们的功能。我似乎不喜欢两者都有。是的,您需要conf/hibernate中的映射文件和src/java中的域类。@JamesA-这样我就不能调用域类上生成的方法了吗?您的域目录中定义了sportsdb.Event类吗?如果您使用的是hibernate映射,那么它应该在src/groovy中。您仍然可以在域对象上调用GORM动态方法。