Re: forcing object update

From: Cris Daniluk (cris.danilu..mail.com)
Date: Wed Sep 28 2005 - 11:28:34 EDT

  • Next message: Andrus Adamchik: "Fwd: Poll: JDK 1.3 support"

    On 9/28/05, Andrus Adamchik <andru..bjectstyle.org> wrote:
    >
    > BTW, I was planning to remove validateForX calls for "phantom"
    > modifications, so such workaround won't work anyway.
    >
    > http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-355

    Actually, the workaround doesn't work now anyway... it already doesn't
    get called :)

    >
    > Can you use the same approach, but instead of validateForX re-sync
    > the object in your action code before calling commit? I know nothing
    > about WebWork, but you do control the code that executes commit, right?

    Actually, I'm routing everything through Spring (and the Cayenne
    Spring integration). The way its designed, you actually call commit on
    an object, and not on the context at large (even though the commit
    ultimately commits the entire context). So, I could do what you
    suggest and create a sort of pre-commit hook that would work just
    fine.

    I do think this is worth finding an ideal solution to, though... the
    power of the framework and orm working together to manage a
    many-to-many relationship with 2-3 lines of code is pretty awesome and
    compelling.

    Maybe we can look at a formalized method of doing this - where an
    object can register itself in a state (either the persistence state,
    or a new additional state) that says some persistent property needs to
    be computed based on its transient properties. If the object is found
    in this state when commitChanges() is invoked,
    applyTransientProperties() or something is called. Then, when the
    snapshots are compared, differences would be found.

    What do you think?

    Cris



    This archive was generated by hypermail 2.0.0 : Wed Sep 28 2005 - 11:28:35 EDT