Re: Why is a refetchObject required

From: Steve Wells (stwell..wnmail.net)
Date: Thu Mar 25 2004 - 04:56:57 EST

  • Next message: Andrus Adamchik: "Re: Why is a refetchObject required"

    Well after having created a simplified version of my app I could not
    re-create the problem, even worse somewhere I have fixed the problem in
    my "real" app and am not sure why...don't you hate that, rather
    frustrating but I'm sure we've all been there when working too much too
    long :)

    The good thing is I have created for myself a playpen for these kind of
    things that uses Struts, Xdoclet, Ant with all the trimmings, JunitDoclet
    etc etc, and of course Cayenne. I'm happy to share this with anyone who
    would like to look at yet another "sample" app.

    Steve

    ----- Original message -----
    From: "Andrus Adamchik" <andru..bjectstyle.org>
    To: cayenne-use..bjectstyle.org
    Date: Tue, 23 Mar 2004 00:05:42 -0500
    Subject: Re: Why is a refetchObject required

    On Mar 22, 2004, at 9:47 PM, Steve Wells wrote:
    > When I have loaded an Org and call its getToState(), i get a row but
    > the
    > State returned is hollow (this is done from JSP/struts).

    > I then created a method of Org called getStateName(), same thing:
    > State state = this.getToState();
    > return state.getName(); // returns null

    There is nothing wrong with an object returned in HOLLOW state from
    relationship (in fact this is expected), however if after calling
    "getName()" an object still remains HOLLOW, this is strange... Could
    you doublecheck that "getName()" is a generated method that looks like
    that:

    public String getName() {
        return (String)readProperty("name");
    }

    and is not overwritten in the subclass?

    > Also do we need to define the reverse relationsip in 1.1 M4 ?

    There have been no change since 1.0 as far as relationships. You do
    have to have two-way DbRelationships. Also if you have a to-many
    ObjRelationship, some things may not work without a reverse to-one.
    However relationships were made more "lazy" - i.e. if you add set an
    Artist of a Painting, this will not trigger a fetch of all other
    Paintings for this Artist. Also in the nearest future I am planning to
    improve the Modeler UI to make handling of reverse DB relationships
    more transparent.

    Andrus

    -- 
    http://www.fastmail.fm - Consolidate POP email and Hotmail in one place
    



    This archive was generated by hypermail 2.0.0 : Thu Mar 25 2004 - 05:01:50 EST