a query clears pending changes?

From: Bryan Lewis (brya..aine.rr.com)
Date: Mon Apr 26 2004 - 09:58:46 EDT

  • Next message: Andrus Adamchik: "Re: Hollow state and Tapestry"

    I've been trying Cayenne for the past week in a Tapestry app and it's going
    well. Updating the cayenne-tapestry tutorial to Tap 3.0 was straightforward.
    There's just one thing that's puzzling me.

    I use a single DataContext per session. When each page begins rendering,
    the context is cleared to make sure there are no stale objects hanging around.
    The page then does its work such as making queries to populate the page and
    perhaps creating a new object. The trouble is that a query clears the newly
    registered object. I'm surprised that a query clears the changes pending in
    the context.

    I can think of some work-arounds:

    * Perform all the queries in a page before creating-and-registering the
    object. This works but it forces a cumbersome artificial sequencing onto the
    page operations.

    * Create the new object but don't register it until the form is submitted. The
    trouble is (I think) that relationships on the object can't be updated until
    the object is registered.

    * Use multiple DataContexts, one for editing and another for queries, but this
    can require copying objects from one context to the other.

    What am I missing?



    This archive was generated by hypermail 2.0.0 : Mon Apr 26 2004 - 10:00:27 EDT