|
Hi,
I remember someone asking this question sometime earlier. http://www.nabble.com/associations-between-domain-classes-in-jars-and-grails-app-domain-td20794417.html I'm wondering if the following is possible using GORM. I have a collection of legacy java domain objects and hibernate mapping files that I access from a jar in the lib directory. These are mapped using a hibernate.cfg.xml file in the conf/hibernate directory. These are fully accessible when using the GORM dynamic methods when my app is running. My problem appears when I try to make a unidirectional association from a newly created groovy domain class to one of the classes contained within the legacy jar. For example, The files in the jar file are ------------- Foo.class Foo.hbm.xml In the new groovy domain class ------------------------------ import org.legacydomain.Foo Class bar { Foo myfoo } This throws a null pointer exception during start-up of the application which seems to occur here (pulled from the full stacktrace.log file) Caused by: java.lang.NullPointerException at org.codehaus.groovy.grails.commons.DefaultGrailsDomainClassProperty.equals(DefaultGrailsDomainClassProperty.java:462) at org.codehaus.groovy.grails.commons.GrailsDomainConfigurationUtil.configureDomainClassRelationships(GrailsDomainConfigurationUtil.java:136) at org.codehaus.groovy.grails.commons.DomainClassArtefactHandler.initialize(DomainClassArtefactHandler.java:43) at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.initializeArtefacts(DefaultGrailsApplication.java:739) at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.initializeArtefacts(DefaultGrailsApplication.java:725) at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.addArtefact(DefaultGrailsApplication.java:695) at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsHibernateUtil.configureDomainClass(GrailsHibernateUtil.java:151) at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsHibernateUtil.configureHibernateDomainClasses(GrailsHibernateUtil.java:111) at org.codehaus.groovy.grails.orm.hibernate.ConfigurableLocalSessionFactoryBean.newSessionFactory(ConfigurableLocalSessionFactoryBean.java:113) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1367) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1333) Does anyone have any suggestions as to why this would be the case? Similarly is it even possible to make this kind of association? Thanks for any help anyone can provide, It would be great if someone can throw some light on what is happening in that part of the code which is causing the issue. 460 GrailsDomainClassProperty otherProp = (GrailsDomainClassProperty) o; 461 boolean namesMatch = otherProp.getName().equals(getName()); 462 boolean typesMatch = otherProp.getReferencedPropertyType().equals(getReferencedPropertyType()); 463 Class myActualClass = getDomainClass().getClazz(); 464 Class otherActualClass = otherProp.getDomainClass().getClazz() ; 465 boolean classMatch = otherActualClass.isAssignableFro Thanks Ram |
| Powered by Nabble | Edit this page |
