我正在尝试在我们的应用程序中启用查询缓存。根据我给的文件
在我的查询中,将hibernate.cache.use_query_cache
用作true
并授予setCacheable()
。但是我变得异常例外。org.hibernate.cache.NoCacheRegionFactoryAvailableException: Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given, please either disable second level cache or set correct region factory class name to property hibernate.cache.region.factory_class (and make sure the second level cache provider, hibernate-infinispan, for example, is available in the classpath).
如果我为查询缓存指定缓存区域,我正在使用Hibernate4。在这方面请帮助我
最佳答案
使用“跟随”进入休眠状态4。
我在休眠4.3中使用它
<property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.use_query_cache">true</property>