How to fix GRAILS-5905

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

How to fix GRAILS-5905

elvanor
Hello all,

I spent the last 3 days looking at Grails & Hibernate code in order to
understand what was wrong with GRAILS-5905, since I really had to fix
it in production for our system. I know understand what's going on (I
updated the JIRA with an explanation, if it's not clear, please ask me
for more details), but I am unsure how to fix it in the optimal way.

As I mention at the end of the JIRA, at least validation should not
occur when we know the object is marked for deletion. Because what
happens here is that a preUpdate event is triggered but eventually
what will happen is that the object will be deleted. So do you know if
there is any easy way to know if the object is marked for deletion at
this point? If there is none, can it be added easily?

Note that if I had failOnError set to true, because of the way the
code is written on
org.codehaus.groovy.grails.orm.hibernate.support.ClosureEventTriggeringInterceptor,
a different exception would have been thrown, that would have made
more sense (here it was very hard to debug because the error looked
like a GORM bug, since the exception was a JDBC SQL constraint
violation - whereas actually it was a validation problem...)

I really would like feedback on this, and once I get it I can write a
patch for this (the analysis work was probably 95% of the work for
me).

Cheers

Jean-Noel

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: How to fix GRAILS-5905

elvanor
Hmm, no reply on this. Still this is a *major* problem in GORM right
now I think. It actually probably affects other bugs as well.
Thoughts?

On Mon, Sep 13, 2010 at 3:24 PM, Jean-Noël Rivasseau <[hidden email]> wrote:

> Hello all,
>
> I spent the last 3 days looking at Grails & Hibernate code in order to
> understand what was wrong with GRAILS-5905, since I really had to fix
> it in production for our system. I know understand what's going on (I
> updated the JIRA with an explanation, if it's not clear, please ask me
> for more details), but I am unsure how to fix it in the optimal way.
>
> As I mention at the end of the JIRA, at least validation should not
> occur when we know the object is marked for deletion. Because what
> happens here is that a preUpdate event is triggered but eventually
> what will happen is that the object will be deleted. So do you know if
> there is any easy way to know if the object is marked for deletion at
> this point? If there is none, can it be added easily?
>
> Note that if I had failOnError set to true, because of the way the
> code is written on
> org.codehaus.groovy.grails.orm.hibernate.support.ClosureEventTriggeringInterceptor,
> a different exception would have been thrown, that would have made
> more sense (here it was very hard to debug because the error looked
> like a GORM bug, since the exception was a JDBC SQL constraint
> violation - whereas actually it was a validation problem...)
>
> I really would like feedback on this, and once I get it I can write a
> patch for this (the analysis work was probably 95% of the work for
> me).
>
> Cheers
>
> Jean-Noel

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: How to fix GRAILS-5905

Graeme Rocher
Administrator
In reply to this post by elvanor
Not easy to fix, you would need to store some temporary state
somewhere (without it leaking memory)



On Mon, Sep 13, 2010 at 3:24 PM, Jean-Noël Rivasseau <[hidden email]> wrote:

> Hello all,
>
> I spent the last 3 days looking at Grails & Hibernate code in order to
> understand what was wrong with GRAILS-5905, since I really had to fix
> it in production for our system. I know understand what's going on (I
> updated the JIRA with an explanation, if it's not clear, please ask me
> for more details), but I am unsure how to fix it in the optimal way.
>
> As I mention at the end of the JIRA, at least validation should not
> occur when we know the object is marked for deletion. Because what
> happens here is that a preUpdate event is triggered but eventually
> what will happen is that the object will be deleted. So do you know if
> there is any easy way to know if the object is marked for deletion at
> this point? If there is none, can it be added easily?
>
> Note that if I had failOnError set to true, because of the way the
> code is written on
> org.codehaus.groovy.grails.orm.hibernate.support.ClosureEventTriggeringInterceptor,
> a different exception would have been thrown, that would have made
> more sense (here it was very hard to debug because the error looked
> like a GORM bug, since the exception was a JDBC SQL constraint
> violation - whereas actually it was a validation problem...)
>
> I really would like feedback on this, and once I get it I can write a
> patch for this (the analysis work was probably 95% of the work for
> me).
>
> Cheers
>
> Jean-Noel
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>



--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

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

    http://xircles.codehaus.org/manage_email