Ehcache 2.10.5 | Related Documentation | Integrations | Using Ehcache with Hibernate | Configuring Ehcache as the Second-Level Cache Provider
 
Configuring Ehcache as the Second-Level Cache Provider
To configure Ehcache as a Hibernate second-level cache, set the region factory property to one of the following in the Hibernate configuration. The Hibernate configuration is specified either via hibernate.cfg.xml, hibernate.properties or Spring. The format shown below is for hibernate.cfg.xml.
Hibernate 3.3 and higher
For instance creation, use:
<property name="hibernate.cache.region.factory_class">
net.sf.ehcache.hibernate.EhCacheRegionFactory</property>
To force Hibernate to use a singleton of Ehcache CacheManager, use:
<property name="hibernate.cache.region.factory_class">
net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory</property>
Hibernate 4.x
For instance creation, use:
<property name="hibernate.cache.region.factory_class">
org.hibernate.cache.ehcache.EhCacheRegionFactory</property>
To force Hibernate to use a singleton of Ehcache CacheManager, use:
<property name="hibernate.cache.region.factory_class">
org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory</property>

Copyright © 2010-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release