Package org.apache.openjpa.persistence

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


            em.merge(detachedIve);
            em.getTransaction().commit();

            em.clear();

            detachedIntegerVe = em.find(IntegerVersionEntity.class, _integerVe.getId());
            detachedNve = em.find(NoVersionEntity.class, _nve.getId());
            detachedIve = em.find(IntVersionEntity.class, _ive.getId());

            // Make sure the updated values were persisted
            assertEquals(detachedIntegerVe.getName(), updatedName);
View Full Code Here


            em.getTransaction().commit();

            em.clear();

            detachedIntegerVe = em.find(IntegerVersionEntity.class, _integerVe.getId());
            detachedNve = em.find(NoVersionEntity.class, _nve.getId());
            detachedIve = em.find(IntVersionEntity.class, _ive.getId());

            // Make sure the updated values were persisted
            assertEquals(detachedIntegerVe.getName(), updatedName);
            assertEquals(detachedNve.getName(), updatedName);
View Full Code Here

            em.clear();

            detachedIntegerVe = em.find(IntegerVersionEntity.class, _integerVe.getId());
            detachedNve = em.find(NoVersionEntity.class, _nve.getId());
            detachedIve = em.find(IntVersionEntity.class, _ive.getId());

            // Make sure the updated values were persisted
            assertEquals(detachedIntegerVe.getName(), updatedName);
            assertEquals(detachedNve.getName(), updatedName);
            assertEquals(detachedIve.getName(), updatedName);
View Full Code Here

        ae = doQuery(em);
        assertEquals("Ava", ae.getName());
        assertEquals(2, ae.getVersion());

        em.clear();
        ae = em.find(AnEntity.class, PKID);
        assertEquals("Ava", ae.getName());
        assertEquals(2, ae.getVersion());

        tran.begin();
        tran.commit();
View Full Code Here

        assertEquals(2, ae.getVersion());

        tran.begin();
        tran.commit();
        em.clear();
        ae = em.find(AnEntity.class, PKID);
        assertEquals("AvaAva", ae.getName());
        assertEquals(3, ae.getVersion());

        em.close();
    }
View Full Code Here

    }
   
    public void testRefresh() {
        if (getCacheEnabled()) {
            OpenJPAEntityManagerSPI em = getEntityManagerFactory().createEntityManager();
            CacheableEntity e1 = em.find(CacheableEntity.class, 1);
            XmlCacheableEntity e2 = em.find(XmlCacheableEntity.class, 1);
            assertNotNull(e1);
            assertNotNull(e2);
            int e1Version = e1.getVersion();
            int e2Version = e2.getVersion();
View Full Code Here

   
    public void testRefresh() {
        if (getCacheEnabled()) {
            OpenJPAEntityManagerSPI em = getEntityManagerFactory().createEntityManager();
            CacheableEntity e1 = em.find(CacheableEntity.class, 1);
            XmlCacheableEntity e2 = em.find(XmlCacheableEntity.class, 1);
            assertNotNull(e1);
            assertNotNull(e2);
            int e1Version = e1.getVersion();
            int e2Version = e2.getVersion();
View Full Code Here

        oem.getTransaction().begin();
        oem.persist(ce);
        oem.getTransaction().commit();
        oem.clear();
        assertTrue(oemf.getCache().contains(CachedEntity.class, id));
        ce = oem.find(CachedEntity.class, id);
       
        assertTrue(dci.getHitCount() > 0);
        assertTrue(dci.getHitCount(clsName) > 0);
        assertTrue(dci.getWriteCount() > 0);
        assertTrue(dci.getCacheStatistics().keySet().contains(clsName));
View Full Code Here

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

        em = emf.createEntityManager();
        pc = em.find(AnnoTest1.class, new Long(1));
        assertEquals("Not Null", new String(pc.getBlob()));
        Connection conn = (Connection) em.getConnection();
        Statement stmnt = conn.createStatement();
        ResultSet rs = stmnt.executeQuery("SELECT BLOBVAL FROM ANNOTEST1 "
            + "WHERE PK = 1");
View Full Code Here

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

        PersistenceCapable pcProperty = (PersistenceCapable) property;
        PersistenceCapable pcField = (PersistenceCapable) field;
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.