首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >为什么在使用hibernate 5.3.1启用hibernate.cfg.xml文件中的查询缓存时会出现异常?

为什么在使用hibernate 5.3.1启用hibernate.cfg.xml文件中的查询缓存时会出现异常?
EN

Stack Overflow用户
提问于 2018-06-21 17:53:20
回答 1查看 337关注 0票数 2

我使用'hibernate 5.3.1.final‘依赖项创建了一个小的二级缓存程序。我使用下面的依赖项来处理二级缓存。

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>5.3.1.Final</version>
</dependency>
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-ehcache</artifactId>
    <version>5.3.1.Final</version>
</dependency>

在这个依赖中,'EhcacheRegionFactory‘包名是changed.so,我们需要在’hibernate.cfg.xml‘文件中使用如下属性。

<property name="hibernate.cache.region.factory_class">
        org.hibernate.cache.ehcache.internal.EhcacheRegionFactory
</property>

在hibernate 5.3中,二级缓存工作正常,但' query-cache‘不工作。当我在’hibernate.cfg.xml‘中启用查询缓存时,我遇到了下面的异常。

->Exception in thread "main" java.lang.ExceptionInInitializerError
->Caused by: org.hibernate.service.spi.ServiceException: Unable to create 
   requested service [org.hibernate.cache.spi.CacheImplementor]
->Caused by: org.hibernate.cache.CacheException: On-the-fly creation of 
  JCache Cache objects is not supported 
  [org.hibernate.cache.spi.TimestampsRegion]

如何解决这个问题?

,但同样的程序,当我尝试使用hibernate 5.2.17依赖项时,查询缓存工作正常。

EN

回答 1

Stack Overflow用户

发布于 2018-08-03 15:38:42

使用Hibernate ORM Hibernate Core»5.3.4最终的依赖项将会工作

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50965573

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档