Hi all,

I'm trying to use the query cache of Cayenne 3.0.

My code snippet for the typical query is:

private List query(Expression qualifier) {
  DataContext context = config.getDomain("MyDomain").createDataContext();
  SelectQuery select = new SelectQuery(MyClass.class, qualifier);
  select.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
  return context.performQuery(select);
}

With this code, if I call my query() method in the following way List b is
empty:
Expression qualifier = ... //my filters
List a = query(qualifier);

DataContext context = config.getDomain("MyDomain").createDataContext();
//this is another context with respect to the one used in query()
MyClass newObj = context.newObject(MyClass .class);
// set props of newObj
context.commitChanges();

List b = query(qualifier); //the same qualifier resulting in List a

The problem seems related to the fact that committing the changes regarding
the newly created object doesn't result in a refresh of the Cayenne cache,
and so the very same result retrieved for List a is returned also for List
b.

Is there any setting or configuration that I need to enable?
Is there any command that I need to issue in order to invalidate the
preiovus results of the cache in this example?

Thank you very much
Best
cghersi



--
View this message in context: 
http://cayenne.195.n3.nabble.com/Cayenne-cache-strategy-tp4008506.html
Sent from the Cayenne - User mailing list archive at Nabble.com.

Reply via email to