RE: caching query behavior changed?

From: Gentry, Michael \(Contractor\) ("Gentry,)
Date: Tue Aug 01 2006 - 15:03:52 EDT

  • Next message: Bryan Lewis: "Re: caching query behavior changed?"

    I know there were some changes in this area with 1.2, but don't recall
    all the details. In fact, I believe I fixed a bug in regards to this
    (I'll have to find the ticket). My gut feeling is this is unintended
    ...

    /dev/mrg

    -----Original Message-----
    From: Bryan Lewis [mailto:brya..aine.rr.com]
    Sent: Tuesday, August 01, 2006 2:52 PM
    To: cayenne-use..ncubator.apache.org
    Subject: caching query behavior changed?

    I have some old code that I've been running for a long time. It creates
    a caching SelectQuery like this:

        SelectQuery query = new SelectQuery("MyEntityName");
        query.setCachePolicy(QueryMetadata.SHARED_CACHE);
        query.setName("MyQueryName");
        if (refreshing) {
            query.setRefreshingObjects(true);
        }
        else {
            query.setRefreshingObjects(false);
        }
        List objects = dataContext.performQuery(query);

    Today someone pointed out to me that the refresh is never happening.
    Indeed, if I call this code with refreshing = true, the log doesn't show
    any SQL generated. (It does emit SQL the first time, of course.) I
    tried various permutations of my code -- with or without ordering and
    prefetching, with local or shared cache. No refreshes. I
    double-checked that isRefreshingObjects() returns true.

    I noticed that the on-line User Guide now recommends specifying such
    queries in the modeler. When I do that, the query works as expected.
    The code boils down to:

        List objects = dc.performQuery("MyQueryName", refreshing);

    I'm wondering whether this was a change in a recent version that I
    missed. Must caching queries be specified only in the modeler now? Or
    is this unexpected and I should try to distill a test case?



    This archive was generated by hypermail 2.0.0 : Tue Aug 01 2006 - 15:04:49 EDT