Re: DataObject becomes hollow when passed through a tapestry DirectLink

From: Erik Hatcher (eri..hatchersolutions.com)
Date: Thu Mar 31 2005 - 05:55:10 EST

  • Next message: Robert Zeigler: "Re: DataObject becomes hollow when passed through a tapestry DirectLink"

    Regarding using a rich (i.e. not a String or simple type) object as a
    parameter in a DirectLink - this is not really recommended in the
    general sense. The URL is going to be hideous and perhaps even too
    long for some browsers to handle.

    A trick within Tapestry, though, would be to use a custom DataSqueezer
    that serialized only the primary key and a unique prefix, and then
    "deserialized" by fetching again using the facility Andrus describes
    below. I have not tried this route - have others?

            Erik

    On Mar 31, 2005, at 3:20 AM, Todd O'Bryan wrote:

    > I also went to using ObjectIds as parameters for DirectLinks. It makes
    > the handling code a little more complex, but seems to work without a
    > hitch. My guess is that serializing/deserializing an ObjectId is also
    > quite a bit less work than a whole DataObject, so Tapestry may be
    > doing less work between requests.
    >
    > Does dc.refetchObject(ObjectId) also do the right thing, or should I
    > fix all of my current calls to use objectForPK so that things don't
    > get refetched from the DB if they don't need to be?
    >
    > Thanks,
    > Todd
    >
    > On Mar 30, 2005, at 9:25 PM, Andrus Adamchik wrote:
    >>
    >> Yep, this is a good solution ... Besides you don't have to refetch
    >> (in a sense of doing a DB round trip), just use
    >> DataObjectUtils.objectForPK - it will get an object from cache or
    >> refetch as needed (so it will do the most efficient thing
    >> transparently), and also attach this object to your current
    >> DataContext.
    >>
    >> Andrus
    >>



    This archive was generated by hypermail 2.0.0 : Thu Mar 31 2005 - 05:55:27 EST