2011-05-29 3 views
1

J'essaie de mettre à niveau un projet Grails 1.0.3 vers 1.3.7 et j'ai ce que je crois être des problèmes connexes.Grails 1.0.3 Problèmes de mise à niveau

L'ancien projet contient des fichiers xml Hibernate dans conf/hibernate/Domain1.hbm.xml Je suppose que GORM n'existait pas dans 1.0.3?

Ai-je besoin de convertir essentiellement ce qui est dans les fichiers XML en code Groovy dans les classes de domaine dans le domaine/

Tous les autres détails sont utiles. Merci.

MISE À JOUR -

Tous ces changements sont le résultat d'un org.hibernate.DuplicateMappingException On dirait que je peux déplacer les fichiers de domaine: Relevant Post Est-ce vraiment ce que je veux faire bien? Ma compréhension est qu'avec GORM je n'aurais pas besoin d'utiliser les fichiers xml du tout.

est ici une exception

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 

Répondre

3

GORM certainement existé dans Grails 1.0.3.

Vous devrez probablement juste mettre à jour votre configuration d'hibernation pour 1.3.7. Jetez un oeil à la Grails and Hibernate - Reference Documentation

Sauf si vous mappez vers un schéma de base de données hérité ou inhabituel, la modélisation de domaine GORM standard est la voie à suivre. C'est très flexible.

+0

@JamesA - Merci pour le lien et l'info. Cependant, le xml hibernate semble bien comparé au lien, donc je ne suis pas sûr. D'autres idées? – skaz

+0

@JamesA - Je crois que je devrai avoir hibernate xml ET les objets de domaine qui auront des fonctions pour les étendre. Il semble que ça n'aime pas que j'ai les deux. – skaz

+0

Oui, vous avez besoin des fichiers de mappage dans conf/hibernate et les classes de domaine dans src/java. – jamesallman

Questions connexes