Re: Hollow State in Tapestry app

From: Todd O'Bryan (toddobrya..ac.com)
Date: Sun Dec 12 2004 - 09:11:35 EST

  • Next message: Todd O'Bryan: "Re: Hollow State in Tapestry app"

    How quickly we forget... I apparently had this problem before (see
    exchange below), but I must have switched my handling method so that I
    didn't put Cayenne DataObjects as parameters to DirectLinks. I seem to
    have tried it again, and it still doesn't work. To add to the
    information I posted earlier...

    Here's some debugging code:
    ------------------
    System.out.println("Forum is: " + theForum);
    System.out.println("Forum Name is: " + theForum.getName());
    System.out.println("Forum is: " + theForum);
    -----------------
    Here's the result:
    ----------------
    Forum is: {[]<oid: org.dupontmanual.cayenne.forums.Forum: <id: 260>;
    state: hollow>}

    Forum Name is: null
    Forum is: {[]<oid: org.dupontmanual.cayenne.forums.Forum: <id: 260>;
    state: hollow>}
    ---------------
    Here's the database:
    --------------
    mysql> select * from forum;
    +-----+----------------------+
    | id | name |
    +-----+----------------------+
    | 260 | Intro to Programming |
    +-----+----------------------+
    1 row in set (0.00 sec)
    ----------------
    So it seems like the name should be coming up.

    I'm going to try storing the id as the parameter and then fetch the
    DataObject in the listener method. But I sure would like to know why
    this doesn't work.

    Thanks,
    Todd

      On Apr 26, 2004, at 4:58 AM, Todd O'Bryan wrote:

    > I think I had an epiphany.
    >
    > I notice that my page properties which are CayenneDataObjects can be
    > set programmatically and work (contrary to the thread I mentioned),
    > but only end up in a hollow state if I pass them as a parameter to a
    > Tapestry DirectLink. I'm starting to think that the problem mentioned
    > in the thread has been fixed, but that passing a CayenneDataObject as
    > a parameter means that I'll absolutely have to refetch the object
    once
    > I get the parameter.
    >
    > Is this accurate?

    Not exactly. This may have been the case in 1.0, however in 1.1 there
      is a shared "snapshot" cache kept by DataDomain outside of DataContext.
      So your hollow object can be resolved without a fetch. To confirm that
      it works properly, turn on SQL logging and make sure no queries are
      generated when such a hollow object is accessed.

    Andrus



    This archive was generated by hypermail 2.0.0 : Sun Dec 12 2004 - 09:11:43 EST