Caused by: java.lang.ClassNotFoundException: org.hibernate.cache.EntityRegion
Caused by: java.lang.ClassNotFoundException: org.hibernate.cache.EntityRegion
OR
Caused by: 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 using the hibernate.cache.region.factory_class setting and make sure the second level cache provider (hibernate-infinispan, e.g.) is available on the classpath.
Solution
- Replace POM dependency for net.sf.ehcache : ehcache-core
Replace below lines
dependency net.sf.ehcache ehcache-core 2.6.11 /dependency
From below lines
dependency org.hibernate hibernate-ehcache 4.3.5.Final /dependency
2. set Factory_class in spring.xml file as given below
Replace below lines
prop key="hibernate.cache.region.factory_class" net.sf.ehcache.hibernate.EhCacheRegionFactory/prop prop key="hibernate.cache.use_query_cache"> true/prop
With below lines
prop key="hibernate.cache.region.factory_class"> org.hibernate.cache.ehcache.EhCacheRegionFactory /prop prop key="hibernate.cache.use_query_cache">true /prop
3. Then use setCacheable(true); for your queries in hibernate criteria