Package org.apache.openjpa.persistence

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


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

            // make sure inserting the same row again fails.
            em.getTransaction().begin();
            em.persist(new Person(1));
            try {
                em.getTransaction().commit();
                fail("Should not be able to commit the same row a second time");
            } catch (RollbackException rbe) {
                assertTrue(rbe.getCause() instanceof EntityExistsException);
View Full Code Here


        }
        OpenJPAEntityManagerSPI em = emf.createEntityManager();
        em.getTransaction().begin();
        AllFieldTypes type = new AllFieldTypes();
        em.persist(type);
        em.getTransaction().commit();
        Object oid = em.getObjectId(type);
        assertEquals(Id.class, JPAFacadeHelper.toOpenJPAObjectId(cmd, oid).getClass());
    }
}
View Full Code Here

        XMLFieldAccess fa = new XMLFieldAccess();
        // Set the persistent field through a misnamed setter        
        fa.setStringField("XMLFieldAccess");
       
        em.getTransaction().begin();
        em.persist(fa);
        em.getTransaction().commit();
        em.clear();
       
        // This value of a persistent field was set using the setter
        // above, but this query will use the field name to verify that
View Full Code Here

        XMLPropAccess pa = new XMLPropAccess();
        // Set the persistent field through a misnamed setter        
        pa.setStrProp("PropertyAccess");
       
        em.getTransaction().begin();
        em.persist(pa);
        em.getTransaction().commit();
        em.clear();
       
        // This value of a persistent field was set using the setter
        // above, but this query will use the field name to verify that
View Full Code Here

        dfmpa.setStrField("NonPCSetter");
        // Call setter with property access
        dfmpa.setStringField("XMLDFMPA");
       
        em.getTransaction().begin();
        em.persist(dfmpa);
        em.getTransaction().commit();
        em.clear();
       
        // This value of a persistent property was set using the setter
        // above, but this query will use the property name to verify that
View Full Code Here

        XMLDefPropMixedFieldAccess dpmfa = new XMLDefPropMixedFieldAccess();
        // Call setter with underlying field access
        dpmfa.setStrProp("XMLDPMFA");
       
        em.getTransaction().begin();
        em.persist(dpmfa);
        em.getTransaction().commit();
        em.clear();
       
        // This value of a persistent field was set using the setter
        // above, but this query will use the property name to verify that
View Full Code Here

        // Call base setter with property access
        Date now = new Date();
        ps.setCreateDate(now);
       
        em.getTransaction().begin();
        em.persist(ps);
        em.getTransaction().commit();
        em.clear();
       
        // This value of a persistent field was set using the setter
        // above, but this query will use the property name to verify that
View Full Code Here

        CacheableEntity ce = new CacheableEntity();
        int id = new Random().nextInt();
        ce.setId(id);
       
        oem.getTransaction().begin();
        oem.persist(ce);
        oem.getTransaction().commit();
        oem.clear();
        assertTrue(oemf.getCache().contains(CacheableEntity.class, id));
        ce = oem.find(CacheableEntity.class, id);
       
View Full Code Here

        // Call base setter with property access
        Date now = new Date();
        fs.setCreateDate(now);
       
        em.getTransaction().begin();
        em.persist(fs);
        em.getTransaction().commit();
        em.clear();
       
        // This value of a persistent field was set using the setter
        // above, but this query will use the property name to verify that
View Full Code Here

        // Call base setter with property access
        Date now = new Date();
        ps.setCreateDate(now);
       
        em.getTransaction().begin();
        em.persist(ps);
        em.getTransaction().commit();
        em.clear();
       
        // This value of a persistent field was set using the setter
        // above, but this query will use the property name to verify that
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.