【问题标题】:Configure Query Cache in Hibernate4在 Hibernate4 中配置查询缓存
【发布时间】:2014-04-23 20:37:11
【问题描述】:

我正在尝试在我们的应用程序中启用查询缓存。根据我提供的文档

hibernate.cache.use_query_cache 在我的查询中作为true 和givent 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).

我是否应该为查询缓存指定缓存区域,我使用的是 Hibernate 4。请在这方面帮助我

【问题讨论】:

标签: java spring hibernate caching


【解决方案1】:

在休眠 4 中使用 Follow。

我在休眠 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>

【讨论】:

    猜你喜欢
    • 2010-10-09
    • 2014-06-28
    • 2020-07-22
    • 1970-01-01
    • 1970-01-01
    • 2020-01-31
    • 2013-09-07
    • 2013-06-20
    相关资源
    最近更新 更多