Grails

failure when trying to reference Hibernate xml mapped class from a GORM class

Details

  • Type: Bug Bug
  • Status: In Progress In Progress
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.1.1
  • Fix Version/s: None
  • Component/s: Persistence
  • Labels:
    None
  • Environment:
    jdk 6, windows
  • Testcase included:
    yes

Description

I am trying to reference a persistant object that is mapped using hibernate xml in one of my GORM domain classes. Everything compiles, but when I try to startup the app using "grails run-app" I get...

[main] ERROR mortbay.log - Nested in 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 java.lang.NullPointerException:
java.lang.NullPointerException
at org.codehaus.groovy.grails.commons.DefaultGrailsDomainClassProperty.equals(DefaultGrailsDomainClassProperty.java:471)
at org.codehaus.groovy.grails.commons.GrailsDomainConfigurationUtil.configureDomainClassRelationships(GrailsDomainConfigurationUtil.java:135)
at org.codehaus.groovy.grails.commons.DomainClassArtefactHandler.initialize(DomainClassArtefactHandler.java:44)
at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.initializeArtefacts(DefaultGrailsApplication.java:689)
at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.initializeArtefacts(DefaultGrailsApplication.java:675)
at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.addArtefact(DefaultGrailsApplication.java:645)
at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsHibernateUtil.configureDomainClass(GrailsHibernateUtil.java:121)
at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsHibernateUtil.configureHibernateDomainClasses(GrailsHibernateUtil.java:81)
at org.codehaus.groovy.grails.orm.hibernate.ConfigurableLocalSessionFactoryBean.newSessionFactory(ConfigurableLocalSessionFactoryBean.java:119)

Please see attached file to reproduce the error. Simply unzip and run "grails run-app"

Activity

Hide
Jonathan Koppenhofer added a comment -

This may be related to issue GRAILS-4193

Show
Jonathan Koppenhofer added a comment - This may be related to issue GRAILS-4193
Hide
Graeme Rocher added a comment -

will look at this for RC1

Show
Graeme Rocher added a comment - will look at this for RC1
Hide
Graeme Rocher added a comment -

This error no longer occurs, but another one does in your example:

Caused by: org.hibernate.MappingException: Could not determine type for: test.Phone, at table: contact, for columns: [org.hibernate.mapping.Column(phone)]

This is because you have an association from your Hibernate mapped class to your GORM domain. Relationships between GORM and hibernate mapped entities don't really work and would take a significant re-write of the ORM binding to support both, which certainly won't make it into 1.2

Show
Graeme Rocher added a comment - This error no longer occurs, but another one does in your example:
Caused by: org.hibernate.MappingException: Could not determine type for: test.Phone, at table: contact, for columns: [org.hibernate.mapping.Column(phone)]
This is because you have an association from your Hibernate mapped class to your GORM domain. Relationships between GORM and hibernate mapped entities don't really work and would take a significant re-write of the ORM binding to support both, which certainly won't make it into 1.2
Hide
Mike Wille added a comment -

I just hit this not knowing it wasn't possible. My Grails project is pulling in a large java code base. Up until this point, the java integration (spring, hibernate, controllers, etc) all worked great. Hitting the wall at the last step (connecting grails domain with java domain) was a crushing defeat.

I'd just like to add my support for getting this feature into Grails. Pretty please

Show
Mike Wille added a comment - I just hit this not knowing it wasn't possible. My Grails project is pulling in a large java code base. Up until this point, the java integration (spring, hibernate, controllers, etc) all worked great. Hitting the wall at the last step (connecting grails domain with java domain) was a crushing defeat. I'd just like to add my support for getting this feature into Grails. Pretty please

People

Vote (7)
Watch (7)

Dates

  • Created:
    Updated:
    Last Reviewed: