propsMap.put("openjpa.RemoteCommitProvider", "sjvm");
propsMap.put("openjpa.BrokerImpl", CacheTestBroker.class.getName());
EntityManagerFactory emf =
getEmf(propsMap);
_factory = JPAFacadeHelper.toBrokerFactory(emf);
Broker broker = _factory.newBroker();
try {
broker.begin();
} catch (Exception e) {
System.out.println(
"Exception in TestJPQL2ResultsAndResultClasses setup : \n" +
getStackTrace(e));
}
int j = 0;
for (int i = 0; i < 10; i++) {
// make some common names so that GROUP BY is useful.
if (i % 2 == 0)
j++;
CacheObjectA o;
broker.persist(o = new CacheObjectAChild1("", "results-" + j, i),
null);
o.setDate(new Date());
o.setDateArray(new Date[]{ new Date(10), new Date(20) });
if (i < 5)
o.setRelatedB(new CacheObjectB());
}
//Seetha Oct 30,2006
//deleteAll closes the TX. So use the local
//deleteAll fn.
//deleteAll(CacheObjectWithExternalizedFields.class,());
//deleteAll(broker,CacheObjectWithExternalizedFields.class,true);
CacheObjectWithExternalizedFields o =
new CacheObjectWithExternalizedFields();
broker.persist(o, null);
o.setCls(Broker.class);
broker.commit();
broker.close();
CacheTestHelper.cacheManager(_factory).getSystemQueryCache().clear();
}