我正在将hibernate 5.3.7-Final与hibernate-ehcache-5.3.7.Final一起使用。在pom.xml中,我有:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.3.7.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>5.3.7.Final</version>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>3.3.1</version>
</dependency>
我会使用hibernate-cache,所以在hibernate.cfg.xml中,我有:
<property name="cache.use_second_level_cache">true</property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name="cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
但是当我启动我的应用程序时,我看到警告
Dez 17, 2018 6:06:43 PM
org.hibernate.cache.ehcache.internal.EhcacheRegionFactory <init>
WARN: HHH020100: The Ehcache second-level cache provider for Hibernate is
deprecated. See https://hibernate.atlassian.net/browse/HHH-12441 for details.
谁能告诉我,为什么我看到此警告?我做错了什么?预先感谢。
答案 0 :(得分:0)
<property name="cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
以上属性会将Ehcache 2.x连接为Hibernate缓存,而不是Ehcache3.x。如警告中所链接的问题所示,Ehcache 2.x被Ehcache 3取代,并且通过JCache集成实现了缓存提供程序的集成。
相关链接: