Package org.apache.openjpa.persistence.inheritance.entities.testinterfaces

Examples of org.apache.openjpa.persistence.inheritance.entities.testinterfaces.RootEntity


        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 " +
View Full Code Here


        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();
                    em.clear();
                }
            } 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 " +
View Full Code Here

        for (InheritanceEntityMapping[] tEntities : allEntityGroups ) {
            // Populate Database
            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();
                   
View Full Code Here

TOP

Related Classes of org.apache.openjpa.persistence.inheritance.entities.testinterfaces.RootEntity

Copyright © 2018 www.massapicom. 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.