Re: Object relationships and Visit

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Jun 09 2004 - 10:59:40 EDT

  • Next message: Andrus Adamchik: "Re: Cayenne Article on TheServerSide.com"

    I may need to dig deeper into Tapestry serialization mechanism, but the
    latest Tapestry 3.0 tutorial
    (http://objectstyle.org/cayenne/userguide/quickstart/
    tapestrywebapp.html , also shipped with Cayenne 1.1) seems to be
    working just fine.

    Could you try how your app works with Visit DataContext and passing
    objects directly from page to page in action methods, kind of like the
    tutorial does? I would be surprised if this doesn't work. If it
    doesn't, please open a high-priority bug report with details.

    > PS My wife just had a baby, so my access to the list will be somewhat
    > sporadic in the next few days.

    Congratulations! I guess now you have more important priorities than
    Tapestry serialization :-)

    Andrus

    On Jun 8, 2004, at 4:35 PM, Reinier Mostert wrote:
    > Hi All,
    >
    > I use Cayenne with Tapestry. First some background: in the constructor
    > of my Tapestry Visit, I do:
    > dataContext =
    > Configuration.getSharedConfiguration().getDomain().createDataContext();
    >
    > This dataContext is then retrieved everywhere I need access to Cayenne.
    > I assumed that when I do this the dataContext spans the whole session.
    >
    > When I started using this (eons ago), I got problems when I do a commit
    > (some exception about the object being registered with a different
    > dataContext). I mailed on this list and the Tapestry list, and
    > received
    > replies to the effect that this was an artifact of the new way Tapestry
    > 3 operates and how it stores items in the HTTPSession.
    >
    > I then started passing record keys around, and added a method to every
    > Cayenne class that returns the key. I have a dataFactory that takes a
    > key and returns a Cayenne Data object (using registeredObject).
    >
    > Now the problem: I'm using object relationships, and when I add rows
    > to
    > a one to many on one page, and try to read the list on another page,
    > they're not in sync. On each page I get the dataContext from the
    > visit.
    > I've started resolving that by using addPrefetch to refresh the object
    > and the relationships, but it is not very elegant.
    >
    > A recent post by Andrus (Re: Cayenne Article on TheServerSide.com)
    > makes
    > me think that this is all unneccessary.
    >
    > Can anybody share on how they pass objects between pages (or their
    > related classes), and how I should be going about having a datacontext
    > that spans the session and makes object relationships work?
    >
    > Thanks in advance
    > reinier
    >
    > PS My wife just had a baby, so my access to the list will be somewhat
    > sporadic in the next few days.
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Jun 09 2004 - 10:59:46 EDT