Re: questions regarding prefetch

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sat Mar 13 2004 - 13:51:02 EST

  • Next message: Andrus Adamchik: "Re: CayenneDataObject.read/writeProperty(...) protected vs public"

    Hi Tore,

    I saw your updates to CAY-105 during the last week. However I was
    extremely busy with a customer project (and will be till the middle of
    next week), so I couldn't switch to the full "Cayenne mode" to analyze
    and do something about it.

    On Mar 13, 2004, at 12:36 PM, Tore Halset wrote:
    > Hello.
    >
    > I am trying to track down a prefetch bug (CAY-105). All the prefetch
    > queries are done correctly, but it looks like a some of the toMany
    > relations are faulted even when it should contain data.
    >
    > It looks like toMany-relations with more than one step is not working.
    > Like addPrefetch("aToMany.bToMany).
    >
    > In SelectObserver.getResultsAsObjects(DataContext, Query) only
    > prefetchQueries with a singleStepToManyRelationship are merged with
    > SelectObserver.mergePrefetchResultsRelationships. Is that correct?

    You are right. Multi-step to-many are indeed not handled well. I think
    we should fix "getResultsAsObjects" to detect the source object of the
    last component in "to many" multi-step path, and resolve its to-many
    from the prefetched data. Will take a look at this once I get a break
    from my other project.

    > Another question about prefetch. I see that PrefetchHelper are only
    > called from DataContext.prefetchRelationships, but that methode does
    > not seem to be called from anywhere. Are PrefetchHelper obsolete or am
    > I missing something?

    DataContext.prefetchRelationships and PrefetchHelper were intended as a
    public API. The difference from regular prefetching is that it builds
    query based on a list of ObjectIds (and ultimately indexed PK columns).
    The idea was that it may be faster than using a qualifier from the
    original query (potentially with multiple joins, etc.). So it a
    prefetch performance optimization for a subset of cases.

    Since it is not a generic method to do prefetching, I think we should
    probably deprecate it in its current form (both
    DataContext.prefetchRelationships and PrefetchHelper class), and move
    it to QueryUtils...

    Thanks
    Andrus



    This archive was generated by hypermail 2.0.0 : Sat Mar 13 2004 - 13:51:08 EST