Examples of IOrderedElements


Examples of org.apache.openjpa.persistence.jpql.entities.IOrderedElements

            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 {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.