public void testManagedInterfaceAndBase() {
OpenJPAEntityManager em = emf.createEntityManager();
// Add some entities
em.getTransaction().begin();
ManagedIface2 mif2 = em.createInstance(ManagedIface2.class);
mif2.setIntFieldSup(12);
SubclassF scf = new SubclassF();
scf.setClassFName("SubclassFName");
scf.setIntFieldSup(13);
BaseClass3 bc3 = new BaseClass3();
bc3.setName("BaseClass3");
em.persist(mif2);
em.persist(scf);
em.persist(bc3);
em.getTransaction().commit();
em.clear();
// Verify that the iface table does not contain a discriminator column
verifyNoDypeColumn(em, "ManagedIface2");
// Verify that the subclass table does not contain a discriminator column
verifyNoDypeColumn(em, "SubclassF");
// Verify that the base class does contain a discriminator column
verifyDtypeColumnEntriesAndMapping(em, "BASECLASS3", 2,
BaseClass3.class);
// Query the subclass table. Make sure the counts are correct and
// the result is castable to the entity and interface types.
verifyInheritanceQueryResult(em, "SubclassF",
classArray(SubclassF.class, ManagedIface2.class, BaseClass3.class),
scf.getId());
// Query the base class table. Make sure the counts are correct and
// the result is castable to the entity and interface types.
verifyInheritanceQueryResult(em, "BaseClass3",
classArray(BaseClass3.class),
scf.getId(), bc3.getId());
// Query the interface2 table. Make sure the count is correct and
// the result is castable to the interface type.
verifyInheritanceQueryResult(em, "ManagedIface2",
classArray(ManagedIface2.class),
scf.getId(), mif2.getId());
em.close();
}