Re: Making sense of callbacks

From: Andrey Razumovsky (razumovsky.andre..mail.com)
Date: Fri Oct 30 2009 - 04:57:54 EDT

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

    This is not about callbacks on client-side - as far as I know, we don't have
    callbacks on ROP. If I understand correctly, "prePersist" isn't invoked for
    server-side temporary objects when committing from client. I'll try to do
    that on the weekend, but I'm not sure

    2009/10/30 Andrus Adamchik <andru..bjectstyle.org>

    > Andrey do have time to check that? If not I may try investigating it over
    > the weekend (although I never used callbacks with ROP, so I am not fully
    > sure how they are expected to work). This may warrant a release recall.
    >
    > Andrus
    >
    >
    >
    > On Oct 30, 2009, at 4:43 AM, Lachlan Deck wrote:
    >
    >> Hi Andrus,
    >>
    >> On 04/10/2009, at 12:37 AM, Andrus Adamchik wrote:
    >>
    >> I finished this per CAY-1281. Project upgrade is performed on opening it
    >>> in the Modeler, so migration for the existing callback users is
    >>> straightforward.
    >>>
    >>> Haven't checked whether that works for ROP. I would appreciate if
    >>> somebody could help me with that.
    >>>
    >>
    >> I can confirm that this is broken (unless I've missed something obvious)
    >> in ROP after updating to 3.0B1
    >>
    >> After the update it appears that an entity record is not properly
    >> initialised when saving from ROP. i.e., server-side validation is throwing
    >> some NPEs and/or thinking that values haven't been set (perhaps a
    >> serialisation issue?). However, the validation on the client-side would have
    >> caught this as, for the most part, the validation is the same.
    >>
    >> I refactored all our current server-side prePersist methods to postAdd and
    >> the problem saving from the client continues.
    >>
    >> Rolling back the cayenne jar(s) fixes the problem.
    >>
    >> Any suggestions?
    >>
    >> On Sep 28, 2009, at 9:53 AM, Andrus Adamchik wrote:
    >>>
    >>>
    >>>> On Sep 28, 2009, at 4:08 AM, Lachlan Deck wrote:
    >>>>
    >>>>
    >>>>> So from what I can see the only two changes required were 'postInsert'
    >>>>> and adjusting the meaning of prePersist
    >>>>>
    >>>>
    >>>> I also tend to think that less is better. This discussion thread was a
    >>>> nice brainstorming on the callbacks use patterns. So we've played with a few
    >>>> things and now I am fine if we go a full circle to the minimal change
    >>>> suggested earlier, and don't worry about JPA users, extra delete callbacks,
    >>>> or symmetry between callback types (in many respects there's little symmetry
    >>>> if you look at the object lifecycle -
    >>>> http://cayenne.apache.org/doc/persistent-object-lifecycle.html).
    >>>>
    >>>> So here is the change I am going to make:
    >>>>
    >>>> 1. Call "prePersist" before commit
    >>>> 2. Introduce "postAdd" instead of current "prePersist".
    >>>>
    >>>> This change is minimal and is not incompatible with other ideas.
    >>>> Objections?
    >>>>
    >>>> Andrus
    >>>>
    >>>
    >> with regards,
    >> --
    >>
    >> Lachlan Deck
    >>
    >>
    >>
    >>
    >>
    >

    -- 
    Andrey
    



    This archive was generated by hypermail 2.0.0 : Fri Oct 30 2009 - 04:58:51 EDT