Joint Prefetches

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Mar 07 2005 - 00:44:33 EST

  • Next message: Andrus Adamchik: "Re: Joint Prefetches"

    Just finished a new feature - joint prefetches in SelectQueries. Still
    need to document that, but at the user level it comes down to
    "SelectQuery.addJointPrefetch()". What's good about joint prefetches:

    * they retrieve multiple related objects in one query instead of many
    * they support prefetching on flattened relationships (so I closed
    CAY-15), while regular prefetches do not (see CAY-285)

    What's bad about joint prefetches (incorrect results)

    * All the joins are inner joins, so you may not get the result you want.
    * Qualifying root entity on an attribute of a related entity that is
    joined via to-many will result. This problem is much worse as it breaks
    the object graph...

    I can see a number of fixes. One is to allow scripting of join
    semantics (e.g. instead of "myRelationship" do "myRelationship:outer").
    Another one is to quietly (or not so quietly) ignore dangerous
    prefetches (e.g. prefetches matching pieces of qualifier). And yet
    another one is to automatically attempt to outer joins when we expect
    trouble...

    Also if you are monitoring cayenne-cvs list, I did some refactoring of
    query result reader classes. Now they actually make sense (see
    RowDescriptor and JDBCResultIterator). Please let me know if anything
    is broken.

    Andrus



    This archive was generated by hypermail 2.0.0 : Mon Mar 07 2005 - 00:44:38 EST