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 - 14:52:45 EDT