}
public void testInheritance() {
OpenJPAEntityManager pm =
(OpenJPAEntityManager) currentEntityManager();
DerivedEntity de = (DerivedEntity) newInstance(pm, DerivedEntity.class);
BasicSubclassInstance basic = (BasicSubclassInstance) newInstance(pm,
BasicSubclassInstance.class);
basic.setStringField("basic one-to-one");
de.setOneToOne(basic);
Object oid = persistenceOperations(pm, de, false);
// ##### need a test case for JDOHelper.createEntityManager() for
// subclass
ClassMetaData meta = JPAFacadeHelper.getMetaData(pm, de.getClass());
assertEquals(BaseEntity.class, meta.getPCSuperclass());
pm = (OpenJPAEntityManager) currentEntityManager();
Object o = pm.find(DerivedEntity.class, oid);
assertTrue(o instanceof DerivedEntity);
de = (DerivedEntity) o;
Broker b = JPAFacadeHelper.toBroker(pm);
OpenJPAStateManager sm = b.getStateManager(de);
// we use getLoaded() here because isLoaded() always returns true.
assertFalse(sm.getLoaded().get(
sm.getMetaData().getField("oneToOne").getIndex()));
assertEquals("basic one-to-one", de.getOneToOne().getStringField());
assertTrue(sm.getLoaded().get(sm.getMetaData()
.getField("oneToOne").getIndex()));
startTx(pm);
pm.remove(de);