*/
public void testAllegedConcurrentModificationException() throws Exception {
OpenJPAEntityManager em = (OpenJPAEntityManager) factory
.createEntityManager();
CacheObjectE e;
try {
ClassMetaData meta = JPAFacadeHelper.getMetaData(em,
CacheObjectE.class);
if (!isOpenJPACache(meta.getDataCache()))
return;
startTx(em);
e = new CacheObjectE("e");
em.persist(e);
endTx(em);
}
finally {
endEm(em);
}
em = factory.createEntityManager();
try {
startTx(em);
// find the new object...
OpenJPAQuery q = em.createQuery("select a FROM "
+ CacheObjectE.class.getSimpleName()
+ " a where a.str = 'e'");
e = (CacheObjectE) ((Collection) q.getResultList()).iterator()
.next();
// ... and modify the changed object.
e.setStr("e2");
e.setStr("e3");
endTx(em);
}
finally {
endEm(em);
}