Tidy up of flattened rels

From: Craig Miskell (cmiskel..lbatross.co.nz)
Date: Thu Mar 27 2003 - 16:28:40 EST

  • Next message: Andrus Adamchik: "Re: Tidy up of flattened rels"

    Hi all,
            While writing docos on flattened relationships a few weeks back
    (integrating a contribution from a user), I realised/discovered that a
    toOne->toOne flattened relationship doesn't currently work. (Bah
    humbug). Personal life and other crises have prevented me spending a lot
    of time on it (plus it triggered the read-Only issue on ObjRelationship
    leading to Event munging and other fun). Now, I'd like to get it tidied
    up by beta, so that at least it theoretically works :-)

    Example relationship... CorporateUnit has many Departments, which have
    many Employees. Employee has a flattened relationship
    toDept->toCorporateUnit to get directly to it's Corporate unit

    I have two options, both of which require significant munging at different
    places, and it boils down to expectation. Would you (or other users)
    expect that when the Employee in the above example is fetched, that
    cayenne would do a join with Department in order to find the CorporateUnit
    id (internally creating a hollow CorporateUnit object with the fetched
    id), or would you expect that just Employee attributes are fetched, and
    the join only occurs when the CorporateUnit is touched (somehow having
    encoded the source of the department in the Objectid maybe... ).

    Both cause as much pain: the first requires futzing with
    ResultIterator/Descriptor etc to ensure that column names can be
    distinguished (the id of the Dept would need to be part of the results);
    the second requires munging with ObjectId or something equally horrendous.
    Plus there's the issue of expectations and performance (some would say the
    join shouldn't happen until the user explicitly requests it, others might
    say it's worth the hit because you're already fetching the employee).

    Any and all feedback gratefully received :-) (including that which tells
    me I'm a plonker and there's an easier way)

    Craig



    This archive was generated by hypermail 2.0.0 : Thu Mar 27 2003 - 16:32:32 EST