Grails 1.0.3升级问题 [英] Grails 1.0.3 Upgrade Problems
问题描述
旧项目有Hibernate xml文件在conf / hibernate / Domain1.hbm.xml我猜测GORM在1.0.3中不存在?
我是否需要实质上转换xml中的内容文件转换为域中的Domain类中的Groovy代码/ $ / $>
其他任何细节都很有帮助。感谢。
更新 -
所有这些更改都是由 org .hibernate.DuplicateMappingException
它看起来像我可以只移动域文件:相关帖子那真的是我想要做的吗?我的理解是,对于GORM,我根本不需要使用xml文件。
这是一个例外
2011-05-29 16:43:49,616 [main] ERROR context.GrailsContextLoader - 执行bootstraps时出错:创建名为'messageSource'的bean时出错:bean初始化失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'transactionManager'的bean时出错:无法在设置bean属性'sessionFactory'时解析对bean'sessionFactory'的引用;嵌套异常是
org.springframework.beans.factory.BeanCreationException:创建名为'sessionFactory'的bean时出错:init方法调用失败;嵌套异常是org.hibernate.DuplicateMappingException:重复的类/实体映射sportsdb.Event
org.springframework.beans.factory.BeanCreationException:创建名为'messageSource'的bean时出错:Bean初始化失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'transactionManager'的bean时出错:无法在设置bean属性'sessionFactory'时解析对bean'sessionFactory'的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'sessionFactory'的bean时出错:init方法的调用失败;嵌套异常是org.hibernate.DuplicateMappingException:重复类/实体映射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)
。在_GrailsRun_groovy $ _run_closure5_closure12.doCall(_GrailsRun_groovy:158)
。在_GrailsRun_groovy $ _run_closure5_closure12.doCall(_GrailsRun_groovy)
。在_GrailsSettings_groovy $ _run_closure10.doCall(_GrailsSettings_groovy:280)
。在_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.ru在_GrailsRun_groovy中
$ _ $ Run_line $ _run_closure1.doCall(RunApp:33)_GrailsRun_groovy.this $ 4 $ runInline(_GrailsRun_groovy)
_GrailsRun_groovy $ _run_closure1.doCall(_GrailsRun_groovy:59)
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)
导致: org.springframework.beans.factory.BeanCreationException:错误创建名为'transactionManager'的bean:在设置bean属性'sessionFactory'时无法解析对bean'sessionFactory'的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'sessionFactory'的bean时出错:init方法的调用失败;嵌套的异常是org.hibernate.DuplicateMappingException:重复的类/实体映射sportsdb.Event
... 25 more
导致:org.springframework.beans.factory.BeanCreationException:创建名为sessionFactory的bean时出错':调用init方法失败;嵌套异常是org.hibernate.DuplicateMappingException:重复类/实体映射sportsdb.Event
... 25 more
引起:org.hibernate.DuplicateMappingException:重复的类/实体映射sportsdb.Event
... 25 more
GORM肯定存在于Grails中1.0.3。
您可能只需要更新1.3.7的hibernate配置。看一看 I am trying to upgrade a Grails 1.0.3 project to 1.3.7 and am having what I believe are related issues. 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? 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. UPDATE - All of these changes are the result of a Here is an exception
GORM certainly existed in Grails 1.0.3. You'll probably just have to update your hibernate configuration for 1.3.7. Take a look at the Grails and Hibernate - Reference Documentation 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屋!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