Grails

hbm.xml mapped domain classes cause spring failure when a many-to-one relationship exists from non-hbm.xml mapped domain class.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.1.1, 1.2 final
  • Fix Version/s: 1.2.1
  • Component/s: None
  • Labels:
    None
  • Environment:
    Ubuntu 9.10 JDK 1.6.0/Mac OSX 10.6 JDK 1.6.0
  • Testcase included:
    yes

Description

So I originally hit a DuplicateMappingException when trying to upgrade a large 1.1.1 project to 1.2.0. When I consulted the mailing list I was told that placing hbm.xml mapped domain classes in grails-app/domain only worked in 1.1.1 because of a bug and they should be moved to src/groovy. When I moved the affected classes to src/groovy the DuplicateMappingException was replaced with a NullPointerException that was traced back GrailsDomainBinder.java:459. Mailing list conversation: http://old.nabble.com/Grails-1.2.0-DuplicateMappingException-td27055291.html.

Attached is a grails bug-report of a simple project I created using 1.2.0 that is affected by the NullPointerException problem when starting Spring. Any task that starts Spring should fail, i.e. grails shell. If the attached bug-report is run under 1.1.1 it will fail with the same NullPointerException.

If you move src/groovy/Book.groovy to grails-app/domain 1.1.1 is happy again, but 1.2.0 throws DuplicateMappingException.

Activity

Hide
Stan Carney added a comment -
Show
Stan Carney added a comment - Might be related to http://jira.codehaus.org/browse/GRAILS-141 ???
Hide
Graeme Rocher added a comment -

Fixed the DuplicateMappingException problem in 1.2 with this commit:

http://github.com/grails/grails/commit/f9dda513e7c1187ac242d1b7ac563eb90568ca27

If you still feel the NPE is an issue please raise a separate JIRA for that

Show
Graeme Rocher added a comment - Fixed the DuplicateMappingException problem in 1.2 with this commit: http://github.com/grails/grails/commit/f9dda513e7c1187ac242d1b7ac563eb90568ca27 If you still feel the NPE is an issue please raise a separate JIRA for that
Hide
Stan Carney added a comment -

Thanks Graeme. I just verified it in 1.2.1 and my original issue was resolved. I don't think domain classes should exist outside of the domain directory so the NullPointerException is a non-issue. I would have tested this sooner but I'm not that familiar with Github and couldn't determine if nightly builds were available.

Show
Stan Carney added a comment - Thanks Graeme. I just verified it in 1.2.1 and my original issue was resolved. I don't think domain classes should exist outside of the domain directory so the NullPointerException is a non-issue. I would have tested this sooner but I'm not that familiar with Github and couldn't determine if nightly builds were available.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: