GORM question

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

GORM question

Jeremy Aston
Hi,

I have a pretty basic (hopefully) question on relationship mapping.

I have two objects - a referral and a member - that represent a  
business model where members of a club can pass each other  
referrals.  So... a referral has a member that provides (provider)  
the referral to a receiving member (receiver).  In my Referral domain  
class I have the following:

Member provider
Member receiver

def belongsTo = Member

Is this the best way of modelling this as it's really a many to many  
which Grails does not support yet.

Cheers

jez




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

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: GORM question

graemer
Yup sounds perfectly reasonably this is how many-to-many relationships
are handled  currently with mapping classes.

It is still a pretty nice solution because combined with dynamic
methods and gpath you can do some interesting things:

List referredMembers = Referral.findAllByProvider(provider).receiver
referredMembers.each { println it }

Graeme

On 7/30/06, Jeremy Aston <[hidden email]> wrote:

> Hi,
>
> I have a pretty basic (hopefully) question on relationship mapping.
>
> I have two objects - a referral and a member - that represent a
> business model where members of a club can pass each other
> referrals.  So... a referral has a member that provides (provider)
> the referral to a receiving member (receiver).  In my Referral domain
> class I have the following:
>
> Member provider
> Member receiver
>
> def belongsTo = Member
>
> Is this the best way of modelling this as it's really a many to many
> which Grails does not support yet.
>
> Cheers
>
> jez
>
>
>
>
> ---------------------------------------------------------------------
> 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