Examples of Entity1


Examples of org.apache.openjpa.persistence.common.apps.Entity1

    public void testGetSingleList() {
        EntityManager em = currentEntityManager();
        String curr = 2 + "";

        Entity1 ret =
            (Entity1) em.createQuery("SELECT o FROM Entity1 o WHERE o.pk = 2")
                .getSingleResult();

        assertNotNull(ret);
        assertEquals("string2", ret.getStringField());
        assertEquals(4, ret.getIntField());

        endEm(em);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.common.apps.Entity1

        List l = em.createQuery("Select object(o) from Entity1 o")
            .setFirstResult(3)
            .getResultList();

        Entity1 ent = (Entity1) l.get(0);

        assertNotNull(ent);
        assertEquals("string3", ent.getStringField());
        assertEquals(5, ent.getIntField());

        endEm(em);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.common.apps.Entity1

        EntityManager em = currentEntityManager();
        startTx(em);

        //create and persist multiple entity1 instances
        for (int i = 0; i < instNum; i++) {
            Entity1 ent = new Entity1(i, "string" + i, i + 2);
            Entity2 ent2 = new Entity2(i * 2, "ent2" + i, i);
            ent.setEntity2Field(ent2);
            em.persist(ent);
        }

        endTx(em);
        endEm(em);
View Full Code Here

Examples of org.apache.openjpa.persistence.common.apps.Entity1

    public void testGetSingleList() {
        EntityManager em = currentEntityManager();
        String curr = 2 + "";

        Entity1 ret =
            (Entity1) em.createQuery("SELECT o FROM Entity1 o WHERE o.pk = 2")
                .getSingleResult();

        assertNotNull(ret);
        assertEquals("string2", ret.getStringField());
        assertEquals(4, ret.getIntField());

        endEm(em);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.common.apps.Entity1

        List l = em.createQuery("Select object(o) from Entity1 o order by o.pk")
            .setFirstResult(3)
            .getResultList();

        Entity1 ent = (Entity1) l.get(0);

        assertNotNull(ent);
        assertEquals("string3", ent.getStringField());
        assertEquals(5, ent.getIntField());

        endEm(em);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.enhance.common.apps.Entity1

        OpenJPAEntityManager pm =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(pm);
        deleteAll(Entity1.class);
        endTx(pm);
        Entity1 o = new Entity1(8, "pk 8", 4);
        startTx(pm);
        pm.persist(o);
        endTx(pm);
        Object oid = pm.getObjectId(o);
        endEm(pm);

        pm = (OpenJPAEntityManager) currentEntityManager();
        o = (Entity1) pm.find(Entity1.class, oid);

        try {
            o.setStringField("hello");
            fail("non-transactional write should not be allowed");
        } catch (Exception e) {
            // expected
        } finally {
            endEm(pm);
View Full Code Here

Examples of org.apache.openjpa.persistence.enhance.common.apps.Entity1

        OpenJPAEntityManager pm =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(pm);
        deleteAll(Entity1.class);
        endTx(pm);
        Entity1 o = new Entity1(8, "pk 8", 4);
        startTx(pm);
        pm.persist(o);
        endTx(pm);
        Object oid = pm.getObjectId(o);
        endEm(pm);

        pm = (OpenJPAEntityManager) currentEntityManager();
        o = (Entity1) pm.find(Entity1.class, oid);

        try {
            o.setStringField("hello");
            fail("non-transactional write should not be allowed");
        } catch (Exception e) {
            // expected
        } finally {
            endEm(pm);
View Full Code Here

Examples of org.apache.openjpa.persistence.jdbc.common.apps.mappingApp.Entity1

    public void setUp() {
        super.setUp(CLEAR_TABLES, Entity1.class, Entity2.class);

        em = emf.createEntityManager();
        em.getTransaction().begin();
        em.persist(new Entity1(1, CONST_NAME, CONST_INT));
        em.persist(new Entity1(2, CONST_NAME+" Changed", CONST_INT+1));
        em.persist(new Entity1(3, CONST_NAME+" Changed 2", CONST_INT+2));
        em.getTransaction().commit();
        em.getTransaction().begin();
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.jdbc.common.apps.mappingApp.Entity1

    public void setUp() {
        super.setUp(CLEAR_TABLES, Entity1.class, Entity2.class);

        em = emf.createEntityManager();
        em.getTransaction().begin();
        em.persist(new Entity1(1, CONST_NAME, CONST_INT));
        em.persist(new Entity1(2, CONST_NAME+" Changed", CONST_INT+1));
        em.persist(new Entity1(3, CONST_NAME+" Changed 2", CONST_INT+2));
        em.getTransaction().commit();
        em.getTransaction().begin();
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.Entity1

        deleteAll(Entity1.class);

        EntityManager em = currentEntityManager();
        startTx(em);

        Entity1 b = new Entity1(3, "STRING", 10);
        em.persist(b);
        em.flush();

        endTx(em);
        endEm(em);
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.