Example usage for org.hibernate.cfg Settings isQueryCacheEnabled

List of usage examples for org.hibernate.cfg Settings isQueryCacheEnabled

Introduction

In this page you can find the example usage for org.hibernate.cfg Settings isQueryCacheEnabled.

Prototype

public boolean isQueryCacheEnabled() 

Source Link

Usage

From source file:de.iteratec.iteraplan.presentation.dialog.Configuration.ConfigurationController.java

License:Open Source License

/**
 * Clears the Hibernate second-level cache.
 * // w w  w.jav a 2 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;
}