List of usage examples for org.hibernate Cache evictQueryRegions
void evictQueryRegions();
From source file:cn.guoyukun.spring.jpa.repository.hibernate.HibernateUtils.java
License:Apache License
/** * ?jpa EntityManagerFactory //from w w w . j av a 2 s.co m * 1? * 2?? * 3? * ? * jpa Cache api ?evict ? * * @param emf * @see org.hibernate.ejb.EntityManagerFactoryImpl.JPACache#evictAll() */ public static void evictLevel2Cache(EntityManagerFactory emf) { Cache cache = HibernateUtils.getCache(emf); cache.evictEntityRegions(); cache.evictCollectionRegions(); cache.evictDefaultQueryRegion(); cache.evictQueryRegions(); cache.evictNaturalIdRegions(); }
From source file:com.daphne.es.monitor.web.controller.HibernateCacheMonitorController.java
License:Apache License
@RequestMapping(value = "/evictQuery") @ResponseBody// w w w . ja va 2s. co m public String evictQuery(@RequestParam(value = "queries", required = false) String[] queries) { boolean queriesEmpty = ArrayUtils.isEmpty(queries); Cache cache = HibernateUtils.getCache(em); if (queriesEmpty) { cache.evictQueryRegions(); cache.evictDefaultQueryRegion(); } else { for (String query : queries) { cache.evictQueryRegion(query); } } return "??"; }
From source file:com.topsem.common.repository.jpa.hibernate.Hibernates.java
License:Apache License
/** * ?jpa EntityManagerFactory //from ww w . jav a 2 s.c om * 1? * 2?? * 3? * ? * jpa Cache api ?evict ? * * @param emf * @see org.hibernate.jpa.internal.EntityManagerFactoryImpl.JPACache#evictAll() */ public static void evictLevel2Cache(EntityManagerFactory emf) { Cache cache = Hibernates.getCache(emf); cache.evictEntityRegions(); cache.evictCollectionRegions(); cache.evictDefaultQueryRegion(); cache.evictQueryRegions(); cache.evictNaturalIdRegions(); }
From source file:de.iteratec.iteraplan.presentation.dialog.Configuration.ConfigurationController.java
License:Open Source License
/** * Clears the Hibernate second-level cache. * /*from w ww . j a v a 2s .c o m*/ * @return the init page */ @RequestMapping public String clearHibernateCache() { Settings settings = sessionFactory.getSettings(); if (settings.isSecondLevelCacheEnabled()) { Cache cache = sessionFactory.getCache(); cache.evictEntityRegions(); cache.evictCollectionRegions(); } if (settings.isQueryCacheEnabled()) { Cache cache = sessionFactory.getCache(); cache.evictDefaultQueryRegion(); cache.evictQueryRegions(); } return initPage; }
From source file:org.jboss.dashboard.database.hibernate.HibernateInitializer.java
License:Apache License
/** * Evict all cache information.// w ww .j av a2s. c om */ public synchronized void evictAllCaches() { Cache cache = getSessionFactory().getCache(); cache.evictQueryRegions(); cache.evictEntityRegions(); cache.evictCollectionRegions(); }
From source file:org.ow2.bonita.util.DbTool.java
License:Open Source License
public static void cleanCache(final String domain, final String sessionFactoryName) throws Exception { // clean 2nd level cache: final SessionFactoryImplementor sessionFactory = getSessionFactory(domain, sessionFactoryName); if (sessionFactory != null) { Cache cache = sessionFactory.getCache(); if (cache != null) { cache.evictDefaultQueryRegion(); cache.evictQueryRegions(); cache.evictCollectionRegions(); cache.evictEntityRegions();/* w ww . j a v a 2s .com*/ } } }