[grails-dev] Hibernate & Cascading Updates

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[grails-dev] Hibernate & Cascading Updates

graemer
At the moment relationships in Grails are set to cascade="all" which
is probably not always going to produce the desired effect.

In our current implementation we have no way to customise this and
because we also have no way to specify the "owning" side of a
relationship we can't intelligently customise it.

So my question is how should we deal with this. Should we provide
cascading configuration:

class Blog {
       @Property cascades = [ "entries" : "all", "owner" : "none" ]

        @Property Owner owner
        @Property Set entries
}

or should we just specify who owns the relationship like in RoR:

class Blog {
     @Property belongsTo = Owner.class
}

Or should we do both?

Graeme
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: [grails-dev] Hibernate & Cascading Updates

Dierk König
from a documenter's point of view, I would go for the RoR
version since that has become a kind of 'standard'.
I'm not sure whether it needs to be a full blown property.
Wouldn't 'def' be sufficient? Maybe even static?

cheers
Mittie

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]On Behalf
> Of Graeme Rocher
> Sent: Montag, 14. November 2005 14:51
> To: [hidden email]
> Subject: [grails-dev] Hibernate & Cascading Updates
>
>
> At the moment relationships in Grails are set to cascade="all" which
> is probably not always going to produce the desired effect.
>
> In our current implementation we have no way to customise this and
> because we also have no way to specify the "owning" side of a
> relationship we can't intelligently customise it.
>
> So my question is how should we deal with this. Should we provide
> cascading configuration:
>
> class Blog {
>        @Property cascades = [ "entries" : "all", "owner" : "none" ]
>
>         @Property Owner owner
>         @Property Set entries
> }
>
> or should we just specify who owns the relationship like in RoR:
>
> class Blog {
>      @Property belongsTo = Owner.class
> }
>
> Or should we do both?
>
> Graeme
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [grails-dev] Hibernate & Cascading Updates

Guillaume Laforge-2
I think I also prefer RoR's convention.

I agree with Dierk that it's not really a property but rather some
static information related to the class itself rather than on a
per-instance basis. Moreover, a property would mean it's potentially
updatable! which it is not!

The sole drawback I see with RoR's belongsTo kind of notation is that
you can't really specify if you do or do not want to cascade.
Sometimes it might be interesting to be able to choose. So perhaps
both propositions should be needed at some point.
I think for a start, let's just concentrate on belongsTo / hasMany /
etc, make automatic cascading, and we'll see later if we really need
more customization.


On 14/11/05, Dierk Koenig <[hidden email]> wrote:

> from a documenter's point of view, I would go for the RoR
> version since that has become a kind of 'standard'.
> I'm not sure whether it needs to be a full blown property.
> Wouldn't 'def' be sufficient? Maybe even static?
>
> cheers
> Mittie
>
> > -----Original Message-----
> > From: [hidden email] [mailto:[hidden email]]On Behalf
> > Of Graeme Rocher
> > Sent: Montag, 14. November 2005 14:51
> > To: [hidden email]
> > Subject: [grails-dev] Hibernate & Cascading Updates
> >
> >
> > At the moment relationships in Grails are set to cascade="all" which
> > is probably not always going to produce the desired effect.
> >
> > In our current implementation we have no way to customise this and
> > because we also have no way to specify the "owning" side of a
> > relationship we can't intelligently customise it.
> >
> > So my question is how should we deal with this. Should we provide
> > cascading configuration:
> >
> > class Blog {
> >        @Property cascades = [ "entries" : "all", "owner" : "none" ]
> >
> >         @Property Owner owner
> >         @Property Set entries
> > }
> >
> > or should we just specify who owns the relationship like in RoR:
> >
> > class Blog {
> >      @Property belongsTo = Owner.class
> > }
> >
> > Or should we do both?
> >
> > Graeme
>


--
Guillaume Laforge
http://glaforge.free.fr/blog/groovy
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [grails-dev] Hibernate & Cascading Updates

graemer
Well actually I had this discussion with Steven about static
properties and most of the configurational aspects of grails domain
classes should be static and we should encourage this as best
practise..

My only problem with using def is that it easier to configure a domain
class using java bean properties and springs bean utils. Maybe it just
needs an interceptor to avoid it being set?

Graeme




On 14/11/05, Guillaume Laforge <[hidden email]> wrote:

> I think I also prefer RoR's convention.
>
> I agree with Dierk that it's not really a property but rather some
> static information related to the class itself rather than on a
> per-instance basis. Moreover, a property would mean it's potentially
> updatable! which it is not!
>
> The sole drawback I see with RoR's belongsTo kind of notation is that
> you can't really specify if you do or do not want to cascade.
> Sometimes it might be interesting to be able to choose. So perhaps
> both propositions should be needed at some point.
> I think for a start, let's just concentrate on belongsTo / hasMany /
> etc, make automatic cascading, and we'll see later if we really need
> more customization.
>
>
> On 14/11/05, Dierk Koenig <[hidden email]> wrote:
> > from a documenter's point of view, I would go for the RoR
> > version since that has become a kind of 'standard'.
> > I'm not sure whether it needs to be a full blown property.
> > Wouldn't 'def' be sufficient? Maybe even static?
> >
> > cheers
> > Mittie
> >
> > > -----Original Message-----
> > > From: [hidden email] [mailto:[hidden email]]On Behalf
> > > Of Graeme Rocher
> > > Sent: Montag, 14. November 2005 14:51
> > > To: [hidden email]
> > > Subject: [grails-dev] Hibernate & Cascading Updates
> > >
> > >
> > > At the moment relationships in Grails are set to cascade="all" which
> > > is probably not always going to produce the desired effect.
> > >
> > > In our current implementation we have no way to customise this and
> > > because we also have no way to specify the "owning" side of a
> > > relationship we can't intelligently customise it.
> > >
> > > So my question is how should we deal with this. Should we provide
> > > cascading configuration:
> > >
> > > class Blog {
> > >        @Property cascades = [ "entries" : "all", "owner" : "none" ]
> > >
> > >         @Property Owner owner
> > >         @Property Set entries
> > > }
> > >
> > > or should we just specify who owns the relationship like in RoR:
> > >
> > > class Blog {
> > >      @Property belongsTo = Owner.class
> > > }
> > >
> > > Or should we do both?
> > >
> > > Graeme
> >
>
>
> --
> Guillaume Laforge
> http://glaforge.free.fr/blog/groovy
>
Loading...