Re: Making sense of callbacks

From: Andrey Razumovsky (razumovsky.andre..mail.com)
Date: Wed Sep 23 2009 - 13:53:46 EDT

  • Next message: Andrus Adamchik: "Re: Making sense of callbacks"

    Hi Andrus,

    I also suffered missing "preInsert" listener a number of times. But, I think
    the moment of when listeners are called (and which of them are called)
    should be easily guessed by what is happening to the object.

    1. call pre/postUpdate for new objects. So new objects will have
    >> pre/postPersist as well as pre/postUpdate callbacks. Of course the main
    >> motivation is that preUpdate is called before save, not after context
    >> insert, so all the relationships are in place.
    >>
    >>
    So there will be four calls in total at object creation. I don't think it is
    transparent that pre- and postUpdate will be called - after all, no updates
    are ever made!

    > 2. stop calling pre/postUpdate for removed objects. This is causing grief
    >> when we need to access relationships of a deleted object.
    >>
    >
    I'm confused. Are pre/postUpdate methods really called for deleted objects?
    If this is so, it definitely must be stopped I think. Only pre/postRemove
    should be called..

    What will be wrong if we just add new type of event - preInsert? Users
    aren't obligated to implement any listener class, after all. I'm afraid the
    changes you suggest will break a lot of existing code

    Thanks,



    This archive was generated by hypermail 2.0.0 : Wed Sep 23 2009 - 13:54:43 EDT