Class<IOrderedElements> entityClass =
(Class<IOrderedElements>)Class.forName(entityType.getEntityClassName());
String entityClassName = entityType.getEntityName();
Integer entityId = 1;
IOrderedElements newEntity = (IOrderedElements)constructNewEntityObject(entityType);
newEntity.setId(entityId);
List<String> namesList = new ArrayList<String>();
for (int i=0; i<Element_Names.length; i++) {
namesList.add(Element_Names[i]);
}
newEntity.setListElements(namesList);
// add the entity
em = emf.createEntityManager();
em.getTransaction().begin();
em.persist(newEntity);
em.getTransaction().commit();
em.clear();
// verify the entity was stored
log.trace("Verifing the entity was stored");
IOrderedElements findEntity = em.find(entityClass, entityId);
assertNotNull("Found entity just created", findEntity);
assertEquals("Verify entity id = " + entityId, entityId.intValue(), findEntity.getId());
assertEquals("Verify entity name = " + entityClass.getName(), entityClass.getName(),
findEntity.getClass().getName());
} catch (Throwable t) {
log.error(t);
throw new RuntimeException(t);
} finally {