Nested GORM embedded

Tag: grails Author: csshuai Date: 2009-08-26

I'm in the process of exporting a Spring (and Hibernate) application to Grails.

Using GORM I wanted to do the following:

class A {
    B b
    static embedded = ['b']
}

class B {
    C c
    static embedded = ['c']
}

class C {
}

And got:

org.hibernate.MappingException: Could not determine type for: C, at table: a, for columns: [org.hibernate.mapping.Column(b_c_id)]

I know I can use my old Hibernate mapping files (that by the way successfully use the Hibernate 'component' tag for that matter) but still:

Is the 'embedded' feature limited to one level? How can I bypass or fix this?

Best Answer

This is a well known grails bug. There's also an existing bug report http://jira.codehaus.org/browse/GRAILS-2773. Unfortunately no one from the Grails team has answered yet.

The easiest way to fix it is using your old Hibernate mapping file. Currently I don't no other solution. Sorry.

comments:

This bug has been fixed in Grails 1.3.2