collections of composite value types

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

collections of composite value types

Marcus Better
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

the "embedded" property allows me to declare a complex property as a component (value type) [1]. However I need a collection of
composite values, which is supported in Hibernate [2], but I cannot get this to work. Is this supported?

Sample domain class Person, with a value-type Address:


class Person {
    static hasMany = [addresses: Address]
}
class Address {
    String number
    String code
}


This gives an exception at startup:

org.hibernate.MappingException: Type [null] is not a basic type or a domain class and cannot be mapped. Either specify a type
within the [mapping] block or use a basic type (String, Integer etc.)
        at
org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.bindCollectionWithJoinTable(GrailsDomainBinder.java:618)
        at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.bindCollectionSecondPass(GrailsDomainBinder.java:527)
        at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.access$100(GrailsDomainBinder.java:75)
        at
org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder$GrailsCollectionSecondPass.doSecondPass(GrailsDomainBinder.java:216)

Cheers,

Marcus


[1] http://www.grails.org/doc/latest/guide/5.%20Object%20Relational%20Mapping%20(GORM).html#5.2.2 Composition in GORM
[2] http://docs.jboss.org/hibernate/core/3.5/reference/en/html/components.html#components-incollections
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkwrBf8ACgkQXjXn6TzcAQk71wCgpQGGpQB6ZPQ2GBop6kG1l7D+
qbUAnjyZtUgb/dJlvLNiJl+D/H442XDb
=1Lwj
-----END PGP SIGNATURE-----



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: collections of composite value types

elvanor
Hi,

I needed exactly this today too. It is indeed supported in Hibernate
but does not see to be supported in GORM. Can anyone confirm or point
to the relevant JIRA feature request?

Jean-Noel

On Wed, Jun 30, 2010 at 10:53 AM, Marcus Better <[hidden email]> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> the "embedded" property allows me to declare a complex property as a component (value type) [1]. However I need a collection of
> composite values, which is supported in Hibernate [2], but I cannot get this to work. Is this supported?
>
> Sample domain class Person, with a value-type Address:
>
>
> class Person {
>    static hasMany = [addresses: Address]
> }
> class Address {
>    String number
>    String code
> }
>
>
> This gives an exception at startup:
>
> org.hibernate.MappingException: Type [null] is not a basic type or a domain class and cannot be mapped. Either specify a type
> within the [mapping] block or use a basic type (String, Integer etc.)
>        at
> org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.bindCollectionWithJoinTable(GrailsDomainBinder.java:618)
>        at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.bindCollectionSecondPass(GrailsDomainBinder.java:527)
>        at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.access$100(GrailsDomainBinder.java:75)
>        at
> org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder$GrailsCollectionSecondPass.doSecondPass(GrailsDomainBinder.java:216)
>
> Cheers,
>
> Marcus
>
>
> [1] http://www.grails.org/doc/latest/guide/5.%20Object%20Relational%20Mapping%20(GORM).html#5.2.2 Composition in GORM
> [2] http://docs.jboss.org/hibernate/core/3.5/reference/en/html/components.html#components-incollections
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iEYEARECAAYFAkwrBf8ACgkQXjXn6TzcAQk71wCgpQGGpQB6ZPQ2GBop6kG1l7D+
> qbUAnjyZtUgb/dJlvLNiJl+D/H442XDb
> =1Lwj
> -----END PGP SIGNATURE-----
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email