|
The containsQuery(String) method in org.hibernate.internal.CacheImpl does not check if the query cache is enabled. All of the other methods related to the query cache perform this check. If your code calls SessionFactory.getCache().containsQuery("queryCacheRegionName), it will throw a NullPointerException if hibernate.cache.use_query_cache is set to false.
The method should change to something like this:
{{ public boolean containsQuery(String regionName) { boolean containsQuery = false; if ( sessionFactory.getSettings().isQueryCacheEnabled() ) { containsQuery = queryCaches.containsKey( regionName ); }
return containsQuery; }}
|