Re: Relationships refresh possible BUG

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Jun 17 2009 - 08:58:32 EDT

  • Next message: lmarcha..mausa.com: "Re: Relationships refresh possible BUG"

     From your description I don't think there's a problem with either.
    RelationshipQuery is used for internal Cayenne purposes and by itself
    will not update the root object, just fetch a list of related objects.
    RefreshQuery updates the root object, not the related objects.

    Andrus

    On Jun 17, 2009, at 3:50 PM, lmarcha..mausa.com wrote:

    > Sure I will give it a try !
    > I will try to modify some Cayenne unit tests to reproduce the
    > problem I have with RefreshQuery and RelationshipQuery.
    >
    > Thanks.
    > Laurent.
    >
    >
    > Andrus Adamchik a écrit :
    >> Hmm... wonder if the PREFETCH LIMITATION warning is only applicable
    >> to the default disjoint prefetches in 3.0. I have a feeling this
    >> type of prefetching should work with joint prefetches since the day
    >> when we started using OUTER JOINs for them. Could you give it a try?
    >>
    >> Andrus
    >>
    >>
    >> On Jun 11, 2009, at 8:08 PM, lmarcha..mausa.com wrote:
    >>
    >>> Hello all !
    >>>
    >>> I have currently a big problem refreshing my relationships with
    >>> cayenne 3.0M6 (tested with M5 too).
    >>> I have a table JOB with some extended/dynamic properties and
    >>> another related JOB_AUX table (kinda key/value pair table). So
    >>> there is a to-many relationship between JOB->JOB_AUX with the flag
    >>> "To Dep PK" set.
    >>>
    >>> In my JOB editor I display all the extended properties (JOB_AUX),
    >>> and I used to use the JOB.addPrefetch(related_JOB_AUX) to ensure
    >>> that the JOB and it's relationships are fresh each time I fetch a
    >>> job in the editor. I had a problem one day with :
    >>>
    >>> PREFETCH LIMITATION:
    >>> To-many relationships should not be prefetched if a query
    >>> qualifier can
    >>> potentially reduce a number of related objects, resulting in
    >>> incorrect
    >>> relationship list.
    >>>
    >>>
    >>> So I removed the prefetch and tried another way : In my editor I
    >>> need fresh data so I used RefreshQuery(JOB) each time a job is
    >>> selected to be sure that the related JOB_AUX will be fresh, but it
    >>> does not work.
    >>>
    >>> The funny thing is that :
    >>>
    >>> - RefreshQuery(JOB) does not see when a value _change_ in the
    >>> JOB_AUX table, but works when a value is _added_ or _removed._
    >>> - I tried with RelationshipQuery(JOB, related_JOB_AUX, true) but
    >>> it only works when a value is _changed_ in the JOB_AUX table it
    >>> does not when a value is _added_ or _removed._
    >>>
    >>> So I can make my editor work when I use a combination of these two
    >>> queries on the JOB to have fresh data.
    >>> Is this a bug ? do you have a Cayenne test case with an embedded
    >>> database that I can use to reproduce this case ?
    >>>
    >>> Thanks.
    >>> Laurent Marchal.
    >>>
    >>
    >



    This archive was generated by hypermail 2.0.0 : Wed Jun 17 2009 - 08:59:08 EDT