Michael,
If I understand you correctly, "mappedBy" should do the trick:
http://grails.org/doc/2.0.x/ref/Domain%20Classes/mappedBy.htmlRegards,
Alexandre Jacques
On Tue, Mar 13, 2012 at 1:28 PM, MLoe <
[hidden email]> wrote:
> I have a domainclass address. Instances belong either to domainclass A or to
> domainclass B.
>
> What is the best way to implement this.
>
> class Address {
> ...
> static belongsTo = [a: A, b: B]
>
> static constraints = {
> a(nullable: true)
> b(nullable: true)
> }
> }
>
> doesn't work.
>
> Should I use a Link Classes like this?
>
> class AddressA {
> Address address
> static belongsTo = [a: A]
> }
> class AddressB {
> Address address
> static belongsTo = [b: B]
> }
>
> Or is there a better solution?
>
> Thanks, Michael
>
>
> --
> View this message in context:
http://grails.1312388.n4.nabble.com/How-to-implement-multiple-belongsTo-s-tp4469520p4469520.html> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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