HHH-15455 User Guide Contains a reference to hibernate-ehcache, no longer supported

This commit is contained in:
Andrea Boriero 2022-08-22 12:47:25 +02:00 committed by Andrea Boriero
parent beb7a37d02
commit 6507ac4f88
1 changed files with 1 additions and 85 deletions

View File

@ -27,7 +27,7 @@ This section defines the settings which control this behavior.
`org.hibernate.cache.spi.RegionFactory` defines the integration between Hibernate and a pluggable caching provider. `org.hibernate.cache.spi.RegionFactory` defines the integration between Hibernate and a pluggable caching provider.
`hibernate.cache.region.factory_class` is used to declare the provider to use. `hibernate.cache.region.factory_class` is used to declare the provider to use.
Hibernate comes with built-in support for the Java caching standard <<caching-provider-jcache,JCache>> Hibernate comes with built-in support for the Java caching standard <<caching-provider-jcache,JCache>>
and also two popular caching libraries: <<caching-provider-ehcache,Ehcache>> and <<caching-provider-infinispan,Infinispan>>. and also the popular caching library: <<caching-provider-infinispan,Infinispan>>.
Detailed information is provided later in this chapter. Detailed information is provided later in this chapter.
[[caching-config-properties]] [[caching-config-properties]]
@ -615,90 +615,6 @@ Note that caches created this way may not be suitable for production usage (unli
Ehcache, in particular, allows to set such default configuration using cache templates. See the https://www.ehcache.org/documentation/3.0/107.html#supplement-jsr-107-configurations[Ehcache documentation] for more details. Ehcache, in particular, allows to set such default configuration using cache templates. See the https://www.ehcache.org/documentation/3.0/107.html#supplement-jsr-107-configurations[Ehcache documentation] for more details.
==== ====
[[caching-provider-ehcache]]
=== Ehcache
This integration covers Ehcache 2.x, in order to use Ehcache 3.x as second level cache, refer to the <<caching-provider-jcache,JCache integration>>.
[NOTE]
====
Use of the built-in integration for https://www.ehcache.org/[Ehcache] requires that the `hibernate-ehcache` module jar (and all of its dependencies) are on the classpath.
====
[[caching-provider-ehcache-region-factory]]
==== RegionFactory
The hibernate-ehcache module defines two specific region factories: `EhCacheRegionFactory` and `SingletonEhCacheRegionFactory`.
[[caching-provider-ehcache-region-factory-shared]]
===== `EhCacheRegionFactory`
To use the `EhCacheRegionFactory`, you need to specify the following configuration property:
[[caching-provider-ehcache-region-factory-shared-example]]
.`EhCacheRegionFactory` configuration
====
[source, XML, indent=0]
----
<property
name="hibernate.cache.region.factory_class"
value="ehcache"/>
----
====
The `EhCacheRegionFactory` configures a `net.sf.ehcache.CacheManager` for each `SessionFactory`,
so the `CacheManager` is not shared among multiple `SessionFactory` instances in the same JVM.
[[caching-provider-ehcache-region-factory-singleton]]
===== `SingletonEhCacheRegionFactory`
To use the `SingletonEhCacheRegionFactory`, you need to specify the following configuration property:
[[caching-provider-ehcache-region-factory-singleton-example]]
.`SingletonEhCacheRegionFactory` configuration
====
[source, XML, indent=0]
----
<property
name="hibernate.cache.region.factory_class"
value="ehcache-singleton"/>
----
====
The `SingletonEhCacheRegionFactory` configures a singleton `net.sf.ehcache.CacheManager` (see https://www.ehcache.org/apidocs/2.8.4/net/sf/ehcache/CacheManager.html#create%28%29[CacheManager#create()]),
shared among multiple `SessionFactory` instances in the same JVM.
[NOTE]
====
The https://www.ehcache.org/documentation/2.8/integrations/hibernate#optional[Ehcache documentation] recommends using multiple non-singleton ``CacheManager``s when there are multiple Hibernate `SessionFactory` instances running in the same JVM.
====
[[caching-provider-ehcache-missing-cache-strategy]]
==== Ehcache missing cache strategy
By default, the Ehcache region factory
will log a warning when asked to create a cache that is not explicitly configured and pre-started in the underlying cache manager.
Thus if you configure an entity type or a collection as cached, but do not configure the corresponding cache explicitly,
one warning will be logged for each cache that was not configured explicitly.
You may change this behavior by setting the `hibernate.cache.ehcache.missing_cache_strategy` property
to one of the following values:
.Missing cache strategies
[cols=",",options="header",]
|======================================
| Value | Description
|`fail` | Fail with an exception on missing caches.
|`create-warn` | **Default value**. Create a new cache when a cache is not found (see `create` below),
and also log a warning about the missing cache.
|`create` | Create a new cache when a cache is not found, without logging any warning about the missing cache.
|======================================
[WARNING]
====
Note that caches created this way may be very badly configured (large size in particular) unless an appropriate `<defaultCache>` entry is added to the Ehcache configuration.
====
[[caching-provider-infinispan]] [[caching-provider-infinispan]]
=== Infinispan === Infinispan