for (InheritanceEntityMapping[] tEntities : allEntityGroups ) {
int idx = 0;
try {
for (InheritanceEntityMapping tEntity : tEntities) {
RootEntity entity = (RootEntity)
EntityMapping.createEntityObjectInstance(tEntity);
entity.updateId(new Integer(idx++));
entity.setRootEntityData("Root " + (idx - 1));
em.getTransaction().begin();
em.persist(entity);
em.getTransaction().commit();
}
} catch (Exception e) {
fail("Test failed with Exception\n" + e);
}
List<RootEntity> resultList = (List<RootEntity>) em.createQuery(
"SELECT e FROM " + tEntities[0].getEntityName() +
" e ORDER BY e.id").getResultList();
assertEquals(tEntities.length, resultList.size());
idx = 0;
for (Object obj : resultList) {
RootEntity entity = (RootEntity) obj;
Class<? extends RootEntity> actualType = entity.getClass();
Class<? extends RootEntity> expectedType =
tEntities[idx].getEntityClass();
assertEquals(
"Assert Entity " + (idx + 1) + "is entity of type " +