use of org.apache.cayenne.map.EntityResolver in project cayenne by apache.
the class ProcedureQueryCacheKeyIT method testNoCache.
@Test
public void testNoCache() {
EntityResolver resolver = runtime.getDataDomain().getEntityResolver();
ProcedureQuery query = new ProcedureQuery("ABC", Artist.class);
QueryMetadata md1 = query.getMetaData(resolver);
assertEquals(QueryCacheStrategy.NO_CACHE, md1.getCacheStrategy());
assertNull(md1.getCacheKey());
QueryMetadata md2 = query.getMetaData(resolver);
assertEquals(QueryCacheStrategy.NO_CACHE, md2.getCacheStrategy());
assertNull(md2.getCacheKey());
}
use of org.apache.cayenne.map.EntityResolver in project cayenne by apache.
the class ProcedureQueryCacheKeyIT method testLocalCache.
@Test
public void testLocalCache() {
EntityResolver resolver = runtime.getDataDomain().getEntityResolver();
ProcedureQuery query = new ProcedureQuery("ABC", Artist.class);
query.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
QueryMetadata md1 = query.getMetaData(resolver);
assertEquals(QueryCacheStrategy.LOCAL_CACHE, md1.getCacheStrategy());
assertNotNull(md1.getCacheKey());
}
use of org.apache.cayenne.map.EntityResolver in project cayenne by apache.
the class ProcedureQueryCacheKeyIT method testNamedQuery.
@Test
public void testNamedQuery() {
EntityResolver resolver = runtime.getDataDomain().getEntityResolver();
ProcedureQuery query = new ProcedureQuery("ABC", Artist.class);
query.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
QueryMetadata md1 = query.getMetaData(resolver);
assertEquals(QueryCacheStrategy.SHARED_CACHE, md1.getCacheStrategy());
assertEquals("proc:", md1.getCacheKey());
}
use of org.apache.cayenne.map.EntityResolver in project cayenne by apache.
the class ProcedureQueryCacheKeyIT method testCacheFetchOffsetAndLimit.
@Test
public void testCacheFetchOffsetAndLimit() {
EntityResolver resolver = runtime.getDataDomain().getEntityResolver();
ProcedureQuery q1 = new ProcedureQuery("ABC", Artist.class);
q1.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
q1.setFetchOffset(5);
q1.setFetchLimit(3);
ProcedureQuery q2 = new ProcedureQuery("ABC", Artist.class);
q2.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
q2.setFetchOffset(5);
q2.setFetchLimit(3);
assertEquals(q1.getMetaData(resolver).getCacheKey(), q2.getMetaData(resolver).getCacheKey());
}
use of org.apache.cayenne.map.EntityResolver in project cayenne by apache.
the class ObjectDiff method getClassDescriptor.
ClassDescriptor getClassDescriptor() {
// serialization
if (classDescriptor == null) {
EntityResolver entityResolver = object.getObjectContext().getEntityResolver();
this.classDescriptor = entityResolver.getClassDescriptor(entityName);
}
return classDescriptor;
}
Aggregations