cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cghersi <>
Subject Cayenne cache strategy
Date Wed, 23 May 2012 12:07:48 GMT
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);
  return context.performQuery(select);

With this code, if I call my query() method in the following way List b is
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

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

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

View this message in context:
Sent from the Cayenne - User mailing list archive at

View raw message