use of org.apache.cayenne.cache.NestedQueryCache in project cayenne by apache.
the class DataContextFactory method createFromDataContext.
protected ObjectContext createFromDataContext(DataContext parent) {
// child ObjectStore should not have direct access to snapshot cache, so do not
// pass it in constructor.
ObjectStore objectStore = objectStoreFactory.createObjectStore(null);
DataContext context = newInstance(parent, objectStore);
context.setValidatingObjectsOnCommit(parent.isValidatingObjectsOnCommit());
context.setUsingSharedSnapshotCache(parent.isUsingSharedSnapshotCache());
context.setQueryCache(new NestedQueryCache(queryCache));
context.setTransactionFactory(transactionFactory);
return context;
}
use of org.apache.cayenne.cache.NestedQueryCache in project cayenne by apache.
the class CayenneContextFactory method createContext.
public ObjectContext createContext(DataChannel parent) {
boolean changeEvents = properties.getBoolean(ClientConstants.ROP_CONTEXT_CHANGE_EVENTS_PROPERTY, false);
boolean lifecycleEvents = properties.getBoolean(ClientConstants.ROP_CONTEXT_LIFECYCLE_EVENTS_PROPERTY, false);
CayenneContext context = newInstance(parent, changeEvents, lifecycleEvents);
context.setQueryCache(new NestedQueryCache(queryCache));
return context;
}
use of org.apache.cayenne.cache.NestedQueryCache in project cayenne by apache.
the class BaseContext method attachToRuntime.
/**
* Attaches this context to the CayenneRuntime whose Injector is passed as
* an argument to this method.
*
* @since 3.1
*/
protected void attachToRuntime(Injector injector) {
// TODO: nested contexts handling??
attachToChannel(injector.getInstance(DataChannel.class));
setQueryCache(new NestedQueryCache(injector.getInstance(QueryCache.class)));
}
use of org.apache.cayenne.cache.NestedQueryCache in project cayenne by apache.
the class DataContextFactory method createFromGenericChannel.
protected ObjectContext createFromGenericChannel(DataChannel parent) {
// for new dataRowStores use the same name for all stores
// it makes it easier to track the event subject
DataRowStore snapshotCache = (dataDomain.isSharedCacheEnabled()) ? dataDomain.getSharedSnapshotCache() : dataRowStoreFactory.createDataRowStore(dataDomain.getName());
DataContext context = newInstance(parent, objectStoreFactory.createObjectStore(snapshotCache));
context.setValidatingObjectsOnCommit(dataDomain.isValidatingObjectsOnCommit());
context.setQueryCache(new NestedQueryCache(queryCache));
return context;
}
use of org.apache.cayenne.cache.NestedQueryCache in project cayenne by apache.
the class DataContextFactory method createdFromDataDomain.
protected ObjectContext createdFromDataDomain(DataDomain parent) {
// for new dataRowStores use the same name for all stores
// it makes it easier to track the event subject
DataRowStore snapshotCache = (parent.isSharedCacheEnabled()) ? parent.getSharedSnapshotCache() : dataRowStoreFactory.createDataRowStore(parent.getName());
DataContext context = newInstance(parent, objectStoreFactory.createObjectStore(snapshotCache));
context.setValidatingObjectsOnCommit(parent.isValidatingObjectsOnCommit());
context.setQueryCache(new NestedQueryCache(queryCache));
context.setTransactionFactory(transactionFactory);
return context;
}
Aggregations