StatisticsImpl#getCacheRegionStatistics should return null if the query cache is disabled, before calling {{ sessionFactory.getCache().getQueryResultsCache()}}.