.createEntityManager();
OpenJPAEntityManager em1 = (OpenJPAEntityManager) factory
.createEntityManager();
startTx(em0);
CacheObjectA a = (CacheObjectA) em0.find(CacheObjectA.class, oid);
Date d = new Date();
a.setDate(d);
endTx(em0);
DataCache cache = cacheManager(factory).getDataCache(
DataCache.NAME_DEFAULT, false);
assertTrue(cache.contains(oidwithclass));
cache.remove(oidwithclass);
a = (CacheObjectA) em1.find(CacheObjectA.class, oid);
assertTrue(cache.contains(oidwithclass));
try {
PCData data = cache.get(oidwithclass);
ClassMetaData meta =
((OpenJPAEntityManagerFactorySPI) OpenJPAPersistence
.cast(factory)).getConfiguration()
.getMetaDataRepositoryInstance().getMetaData(a.getClass(),
null, false);
FieldMetaData fmd = meta.getField("date");
d = (Date) data.getData(fmd.getIndex());
Broker broker = JPAFacadeHelper.toBroker(em1);
OpenJPAStateManager sm = broker.getStateManager(a);
assertTrue(sm == ((ProxyDate) a.getDate()).getOwner());
assertEquals(Date.class, d.getClass());
}
finally {
endEm(em0);
endEm(em1);