Examples of StoreCache


Examples of org.apache.openjpa.persistence.StoreCache

    public static void terminate()
    {
        try
        {
            // evict all caches
            StoreCache cache = entityManagerFactory.getStoreCache();
            cache.evictAll();
            QueryResultCache queryCache = entityManagerFactory.getQueryResultCache();
            queryCache.evictAll();
           
            // close entity manager factory
            entityManagerFactory.close();
View Full Code Here

Examples of org.apache.openjpa.persistence.StoreCache

        pc.setName(useDataCache ? MARKER_DATACACHE : MARKER_CACHE);
        em.persist(pc);
        em.getTransaction().commit();
       
        Object oid = pc.getId();
        StoreCache dataCache = emf.getStoreCache();
        assertEquals(useDataCache, dataCache.contains(PObject.class, oid));
       
        // Modify the record in the database in a separate transaction using
        // native SQL so that the in-memory instance is not altered
        em.getTransaction().begin();
        String sql = "UPDATE L2_PObject SET NAME='" + MARKER_DATABASE
View Full Code Here

Examples of org.apache.openjpa.persistence.StoreCache

        pc.setName(useDataCache ? MARKER_DATACACHE : MARKER_CACHE);
        em.persist(pc);
        em.getTransaction().commit();
       
        Object oid = pc.getId();
        StoreCache dataCache = emf.getStoreCache();
        assertEquals(useDataCache, dataCache.contains(PObject.class, oid));
       
        // delete the record in the database in a separate transaction using
        // native SQL so that the in-memory instance is not altered
        em.getTransaction().begin();
        String sql = "DELETE FROM L2_PObject WHERE id="+oid;
        em.createNativeQuery(sql).executeUpdate();
        em.getTransaction().commit();
       
        // the object cache does not know that the record was deleted
        assertTrue(em.contains(pc));
        // nor does the data cache
        assertEquals(useDataCache, dataCache.contains(PObject.class, oid));
       
        /**
         * refresh behavior no more depends on current lock. Refresh
         * will always attempt to fetch the instance from database
         * raising EntityNotFoundException.
View Full Code Here

Examples of org.apache.openjpa.persistence.StoreCache

    }

    public void testCacheAll() {
        getEntityManagerFactoryCacheSettings(null, null);
        populate();
        StoreCache cache = emf.getStoreCache();
        assertCacheContents(cache, true, true, true);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.StoreCache

    }

    public void testCacheItems() {
        getEntityManagerFactoryCacheSettings(new Class[] { Item.class }, null);
        populate();
        StoreCache cache = emf.getStoreCache();
        assertCacheContents(cache, false, false, true);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.StoreCache

    public void testCacheItemsAndPurchases() {
        getEntityManagerFactoryCacheSettings(new Class[] { Item.class,
            Purchase.class }, null);
        populate();
        StoreCache cache = emf.getStoreCache();
        assertCacheContents(cache, true, false, true);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.StoreCache

    public void testCacheItemsAndOrders() {
        getEntityManagerFactoryCacheSettings(new Class[] { Item.class,
            Order.class }, null);
        populate();
        StoreCache cache = emf.getStoreCache();
        assertCacheContents(cache, false, true, true);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.StoreCache

    public void testCachePurchasesAndOrders() {
        getEntityManagerFactoryCacheSettings(new Class[] { Purchase.class,
            Order.class }, null);
        populate();
        StoreCache cache = emf.getStoreCache();
        assertCacheContents(cache, true, true, false);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.StoreCache

    public void testExcludePurchases() {
        getEntityManagerFactoryCacheSettings(null,
            new Class[] { Purchase.class });
        populate();
        StoreCache cache = emf.getStoreCache();
        assertCacheContents(cache, false, true, true);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.StoreCache

    }

    public void testExcludeOrders() {
        getEntityManagerFactoryCacheSettings(null, new Class[] { Order.class });
        populate();
        StoreCache cache = emf.getStoreCache();
        assertCacheContents(cache, true, false, true);
    }
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.