Reputation: 21
I created a small second level cache program by using 'hibernate 5.3.1.final' dependency.I used below dependencies to work with Second level cache.
<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>
In this dependency the 'EhcacheRegionFactory' package name was changed.so we need to use like below property in our 'hibernate.cfg.xml'file.
<property name="hibernate.cache.region.factory_class">
org.hibernate.cache.ehcache.internal.EhcacheRegionFactory
</property>
In hibernate 5.3 the second level cache is working fine but 'query-cache' is not working.i am getting below exception when iam enabling the query-cache in '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]
How to solve this one?
But The same program when i tried with hibernate 5.2.17 dependency the query cache working fine.
Upvotes: 2
Views: 474
Reputation: 11
Use Hibernate ORM Hibernate Core » 5.3.4.Final dependencies it will work
Upvotes: 1