Re: Bug Fix: Selecting to-many.

From: Craig Miskell (cmiskel..lbatross.co.nz)
Date: Sat Dec 21 2002 - 21:42:02 EST

  • Next message: Andrus: "Cayenne Alpha 5 is out"

    Nice work. My first thought was that selectRelationshipObjects was doing
    something that QueryAssemblerHelper does already (which was what my first
    implementation of selectRelationshipObjects relied on), but I realised
    that this is a particular niche (the whole point being that there may not
    be a reverse ObjRelationship to use as the basis for creating the path).

    So yes, that looks fine.... flattened relationships are all about
    following the path, and that's just what it does.

    Regarding the more conceptual matters: This work does clarify
    things somewhat... often times in EOF, it is necessary to not define reverse
    relationships because faulting *completely* stuffs performance (like
    fetching 200,000 rows just because you added an object to the small side
    of the relationship!!!!). By doing it this way, the DbRelationship *must*
    be there, as you say from an integrity standpoint, but the ObjRelationship
    needn't be, especially if it simply doesn't make sense, or would cause
    other problems. This further cements the difference between Db and Obj
    levels, in a good way (I was dubious when I first hit Cayenne, but it's
    really growing on me now).

    So, given that DbRelationships are inherently 2-way (by definition... if
    the mapping exists one way, it exists in reverse), it might be good if
    DbRels were somehow separate entities, implicitly linked to both
    DbEntities, but distinctly separate. It's a subtle shift from what we
    have now, but might just work (the collections of DbRels that each
    DbEntity maintains would be referencing these dbrels, not owning them).

    Definitely another release though... maybe before beta? (It might be good
    to get this sort of re-engineering done early)

    Just my $0.02

    Craig

     On Sat, 21 Dec 2002, Andrus wrote:

    > To fix a bug reported here:
    >
    > http://objectstyle.org/cayenne/lists/cayenne-devel/2002/11/0018.html
    >
    > I modified the way to-many relationships are fetched to use DB_PATH
    > expressions. All unit tests seem to pass OK for both flattened and regular
    > relationships. The main fix is in QueryHelper.selectRelationshipObjects().
    >
    > Craig, since I am not all that familiar with how flattened relationships
    > are implemented, do you see any problems with this fix?
    >
    > Also working on the fix helped me to create better requirements for the
    > mapping:
    >
    > 1. ObjRelationship can be one-way with no need to have a reverse relationship.
    >
    > 2. DbRelationship has to be two-way.
    >
    > Having said that, I wonder if (2) can be mapped as a single relationship
    > that is by definition bi-directional, kind of like an integrity constraint
    > (which DbRelationship is in a way)? But this is something to think about
    > for the future releases....
    >
    > Andrus
    >
    >



    This archive was generated by hypermail 2.0.0 : Sat Dec 21 2002 - 21:39:21 EST