javax.persistence.Cache Java Examples

The following examples show how to use javax.persistence.Cache. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: QueryCacheTest.java    From hibernate4-memcached with Apache License 2.0 6 votes vote down vote up
@Test
public void createQueryCacheAndEvictAllThenRetry() throws Exception {
	List<Author> beforeResults = getAuthorsWithQuery("Author query", "어느나라");

	log.warn("#####################################################################");

	HibernateEntityManagerFactory entityManagerFactory = (HibernateEntityManagerFactory) EntityTestUtils.getEntityManagerFactory();
	org.hibernate.Cache cache = entityManagerFactory.getSessionFactory().getCache();
	cache.evictEntityRegions();
	cache.evictQueryRegions();
	cache.evictDefaultQueryRegion();
	cache.evictCollectionRegions();

	log.warn("just eviected all.");
	List<Author> againResults = getAuthorsWithQuery("Author query again after evict all", "어느나라");

	assertThat(againResults).isEqualTo(beforeResults);
	log.warn("#####################################################################");
}
 
Example #2
Source File: EntityTestUtils.java    From hibernate4-memcached with Apache License 2.0 5 votes vote down vote up
public static void destroy() {
    if (emf == null) {
        return;
    }

    Cache cache = emf.getCache();
    log.debug("###### EVICT ALL ######");
    cache.evictAll();
    emf.close();
}
 
Example #3
Source File: MockStockPriceEntityManagerFactory.java    From training with MIT License 4 votes vote down vote up
public Cache getCache() {
    throw new UnsupportedOperationException("Not supported.");
}
 
Example #4
Source File: JPQLBuilderFactoryTest.java    From olingo-odata2 with Apache License 2.0 4 votes vote down vote up
@Override
public Cache getCache() {
  return null;
}
 
Example #5
Source File: TestEntityManagerFactory.java    From lutece-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public Cache getCache( )
{
    // TODO Auto-generated method stub
    return null;
}
 
Example #6
Source File: ReloadableEntityManagerFactory.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Override
public Cache getCache() {
    return delegate().getCache();
}
 
Example #7
Source File: JPQLBuilderFactoryTest.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
@Test
public void testOdataJpaAccessFactory() {

  ODataJPAFactoryImpl oDataJPAFactoryImpl = new ODataJPAFactoryImpl();
  ODataJPAAccessFactory jpaAccessFactory = oDataJPAFactoryImpl
      .getODataJPAAccessFactory();
  ODataJPAContextImpl oDataJPAContextImpl = new ODataJPAContextImpl();

  EntityManagerFactory emf = new EntityManagerFactory() {

    @Override
    public boolean isOpen() {
      // TODO Auto-generated method stub
      return false;
    }

    @Override
    public Map<String, Object> getProperties() {
      // TODO Auto-generated method stub
      return null;
    }

    @Override
    public PersistenceUnitUtil getPersistenceUnitUtil() {
      // TODO Auto-generated method stub
      return null;
    }

    @Override
    public Metamodel getMetamodel() {
      // TODO Auto-generated method stub
      return null;
    }

    @Override
    public CriteriaBuilder getCriteriaBuilder() {
      // TODO Auto-generated method stub
      return null;
    }

    @Override
    public Cache getCache() {
      // TODO Auto-generated method stub
      return null;
    }

    @SuppressWarnings("rawtypes")
    @Override
    public EntityManager createEntityManager(final Map arg0) {
      // TODO Auto-generated method stub
      return null;
    }

    @Override
    public EntityManager createEntityManager() {
      // TODO Auto-generated method stub
      return null;
    }

    @Override
    public void close() {
      // TODO Auto-generated method stub

    }
  };
  oDataJPAContextImpl.setEntityManagerFactory(emf);
  oDataJPAContextImpl.setPersistenceUnitName("pUnit");

  assertNotNull(jpaAccessFactory.getODataJPAMessageService(new Locale(
      "en")));
  assertNotNull(jpaAccessFactory.createODataJPAContext());
  assertNotNull(jpaAccessFactory
      .createJPAEdmProvider(oDataJPAContextImpl));
  assertNotNull(jpaAccessFactory
      .createODataProcessor(oDataJPAContextImpl));

}
 
Example #8
Source File: TestPersistenceProviderResolver.java    From deltaspike with Apache License 2.0 4 votes vote down vote up
@Override
public Cache getCache()
{
    return null;  
}