Top Description Fields Constructors Methods
net.sf.ehcache.hibernate

public final Class EhCacheProvider

extends AbstractEhcacheProvider
Class Inheritance
Annotations
@Deprecated
Imports
java.net.MalformedURLException, .URL, java.util.Properties, net.sf.ehcache.CacheManager, net.sf.ehcache.hibernate.management.impl.ProviderMBeanRegistrationHelper, org.hibernate.cache.CacheException, org.slf4j.Logger, .LoggerFactory

Deprecated

Cache Provider plugin for Hibernate 3.2 and ehcache-1.2. New in this provider are ehcache support for multiple Hibernate session factories, each with its own ehcache configuration, and non Serializable keys and values. Ehcache-1.2 also has many other features such as cluster support and listeners, which can be used seamlessly simply by configurion in ehcache.xml.

Use hibernate.cache.provider_class=net.sf.ehcache.hibernate.EhCacheProvider in the Hibernate configuration to enable this provider for Hibernate's second level cache.

When configuring multiple ehcache CacheManagers, as you would where you have multiple Hibernate Configurations and multiple SessionFactories, specify in each Hibernate configuration the ehcache configuration using the property net.sf.ehcache.configurationResourceName An example to set an ehcach configuration called ehcache-2.xml would be net.sf.ehcache.configurationResourceName=/ehcache-2.xml. If the leading slash is not there one will be added. The configuration file will be looked for in the root of the classpath.

Updated for ehcache-1.2. Note this provider requires ehcache-1.2.jar. Make sure ehcache-1.1.jar or earlier is not in the classpath or it will not work.

See http://ehcache.org for documentation on ehcache

Authors
Greg Luck, Emmanuel Bernard
Version
$Id: EhCacheProvider.java 10789 2018-04-26 02:08:13Z adahanne $

Field Summary

Modifier and TypeField and Description
private static final Logger
private final ProviderMBeanRegistrationHelper
public static final String
NET_SF_EHCACHE_CONFIGURATION_RESOURCE_NAME

The Hibernate system property specifying the location of the ehcache configuration file name.

Inherited from net.sf.ehcache.hibernate.AbstractEhcacheProvider:
manager

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final void
start(Properties
current configuration settings.
properties
)

Implements org.hibernate.cache.CacheProvider.start.

Callback to perform any necessary initialization of the underlying cache implementation during SessionFactory construction.
public final void
stop()

Implements org.hibernate.cache.CacheProvider.stop.

Callback to perform any necessary cleanup of the underlying cache implementation during SessionFactory.close().
Inherited from net.sf.ehcache.hibernate.AbstractEhcacheProvider:
buildCacheisMinimalPutsEnabledByDefaultloadResourcenextTimestamp

Field Detail

LOGback to summary
private static final Logger LOG

Hides net.sf.ehcache.hibernate.AbstractEhcacheProvider.LOG.

mbeanRegistrationHelperback to summary
private final ProviderMBeanRegistrationHelper mbeanRegistrationHelper
NET_SF_EHCACHE_CONFIGURATION_RESOURCE_NAMEback to summary
public static final String NET_SF_EHCACHE_CONFIGURATION_RESOURCE_NAME

The Hibernate system property specifying the location of the ehcache configuration file name.

If not set, ehcache.xml will be looked for in the root of the classpath.

If set to say ehcache-1.xml, ehcache-1.xml will be looked for in the root of the classpath.

Constructor Detail

EhCacheProviderback to summary
public EhCacheProvider()

Method Detail

startback to summary
public final void start(Properties properties) throws CacheException

Implements org.hibernate.cache.CacheProvider.start.

Callback to perform any necessary initialization of the underlying cache implementation during SessionFactory construction.

Parameters
properties:Properties

current configuration settings.

stopback to summary
public final void stop()

Implements org.hibernate.cache.CacheProvider.stop.

Callback to perform any necessary cleanup of the underlying cache implementation during SessionFactory.close().