long q1p1;
long q1p2;
long q2p1;
long q2p2;
Broker broker = JPAFacadeHelper.toBroker(em);
org.apache.openjpa.kernel.Query q = broker.newQuery(
JPQLParser.LANG_JPQL, "Select a FROM "
+ CacheObjectA.class.getSimpleName() + " a");
q.setCandidateExtent(broker.newExtent(CacheObjectA.class, false));
start = System.currentTimeMillis();
assertInCache(q, inCache);
List l = (List) q.execute();
iterate(l);
q1p1 = System.currentTimeMillis() - start;
assertEquals(allSize, l.size());
start = System.currentTimeMillis();
List l2 = (List) q.execute();
iterate(l2);
q1p2 = System.currentTimeMillis() - start;
assertEquals(allSize, l2.size());
q = broker.newQuery(JPQLParser.LANG_JPQL,
"select a.name,a.age from "
+ CacheObjectA.class.getSimpleName()
+ " a where a.name = :n AND a.age = :a");
q.setCandidateExtent(broker.newExtent(CacheObjectA.class, false));
start = System.currentTimeMillis();
assertInCache(q, inCache, new Object[]{ ORIG_NAME,
new Integer(ORIG_AGE) });
l = (List) q.execute(new Object[]{ ORIG_NAME,
new Integer(ORIG_AGE) });