Package org.apache.openjpa.persistence

Examples of org.apache.openjpa.persistence.OpenJPAEntityManagerSPI.find()


    /**
     * This testcase was added for OPENJPA-1400.
     */
    public void testPersistRelationshipToDetchedEntityZeroVersion() {
        OpenJPAEntityManagerSPI em = emf.createEntityManager();
        NoDetachedStateEntityPropertyAccess property = em.find(NoDetachedStateEntityPropertyAccess.class, 1);
        em.close();

        // Make sure we don't hit any exceptions when persisting a relationship to a detached
        // entity.
        em = emf.createEntityManager();
View Full Code Here


        // Make sure we don't hit any exceptions when persisting a relationship to a detached
        // entity.
        em = emf.createEntityManager();
        em.getTransaction().begin();
        NoDetachedStateEntityFieldAccess field = em.find(NoDetachedStateEntityFieldAccess.class, 1);
        field.setRelationship(property);
        em.getTransaction().commit();
        em.close();

        // Make sure that the relationship was persisted
View Full Code Here

        em.getTransaction().commit();
        em.close();

        // Make sure that the relationship was persisted
        em = emf.createEntityManager();
        field = em.find(NoDetachedStateEntityFieldAccess.class, 1);
        property = field.getRelationship();
        assertNotNull(property);
        assertEquals(1, property.getId());

    }
View Full Code Here

                    }
                }   
            } else {
                ((JDBCFetchPlan) em.getFetchPlan())
                    .setIsolation(IsolationLevel.SERIALIZABLE);
                em.find(AllFieldTypes.class, 0);
                if (dict instanceof DB2Dictionary ) {
                    if ((((DB2Dictionary) dict).getDb2ServerType() == 1)
                        || (((DB2Dictionary) dict).getDb2ServerType()== 2)) {
                        assertEquals(1, sql.size());
                        assertSQL("SELECT t0.booleanField, t0.byteField, "
View Full Code Here

        em.getTransaction().commit();
       
        em.clear();
        // Verify list of persistent fields
        PropAccessFieldStratsEntity newpa =
            em.find(PropAccessFieldStratsEntity.class, eid);
        assertNotNull(newpa);
        // simple key validation
        assertEquals(newpa.getEmbedId(), eid);

        // Verify the persistent member names
View Full Code Here

        em.getTransaction().commit();
       
        em.clear();
        // Verify list of persistent fields
        FieldAccessPropStratsEntity newpa =
            em.find(FieldAccessPropStratsEntity.class, eid);
        assertNotNull(newpa);
        // simple key validation
        assertEquals(newpa.getEmbedId(), eid);

        // Verify the persistent member names
View Full Code Here

        em.getTransaction().begin();
        em.persist(mi);
        em.getTransaction().commit();
        em.clear();
       
        MenuItem mi2 = em.find(MenuItem.class, mi.getId());
       
        assertEquals(mi2.getId(), mi.getId());
        Map<String, Ingredient> ing2 = mi2.getIngredients();
        assertTrue(ing2.containsKey("Peanut Butter"));
        Quantity q = ing2.get("Peanut Butter").getQuantity();
View Full Code Here

            em1.getTransaction().commit();

            em.clear();
            em1.clear();

            Person p = em.find(Person.class, 1);
            Person p1 = em1.find(Person.class, 1);
            assertNotSame(p, p1);
            assertEquals("em", p.getName());
            assertEquals("em1", p1.getName());
View Full Code Here

            em1.getTransaction().commit();

            em.clear();
            em1.clear();

            Person p = em.find(Person.class, 1);
            Person p1 = em1.find(Person.class, 1);
            assertNotSame(p, p1);
            assertEquals("em", p.getName());
            assertEquals("em1", p1.getName());
View Full Code Here

        em1.getTransaction().begin();
        em2.getTransaction().begin();
        for (EntityA a : entities) {
            EntityA a1 = em1.find(EntityA.class, a.getId());
            EntityA a2 = em2.find(EntityA.class, a.getId());
            a1.setName("asdf");
            a2.setName("asdf2");
        }
        em1.getTransaction().commit();
        try {
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.