List of usage examples for org.hibernate.cfg Settings isSecondLevelCacheEnabled
public boolean isSecondLevelCacheEnabled()
From source file:de.iteratec.iteraplan.presentation.dialog.Configuration.ConfigurationController.java
License:Open Source License
/** * Clears the Hibernate second-level cache. * /*w w w .ja v a2 s . co 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; }