Use eclipselink.flush-clear.cache
to specify the EclipseLink EntityManager
cache behavior when a clear
method follows the flush
method.
Values
Table 5-36 describes this persistence property's values.
Table 5-36 Valid Values for flush-clear.cache
Value | Description |
---|---|
|
EclipseLink drops the entire Although this is the fastest mode and uses the least memory, the shared cache may potentially contain stale data after performing the commit. |
|
EclipseLink drops the entire This mode is slower than |
|
EclipseLink drops objects the Although this mode leaves the shared cache in a perfect state after performing the commit, it is the least memory-efficient. In a very large transaction you may run out of memory. |
Usage
You can specify this property when creating an EntityManagerFactory
(in the map passed to the createEntityManagerFactory
method or in the persistence.xml
file), or an EntityManager
(in the map passed to the createEntityManager
method).
Note that the latter overrides the former.
Examples
Example 5-25 shows how to use this persistence property extension in the persistence.xml
file.
Example 5-25 Using flush-clear.cache in persistence.xml
<property name="eclipselink.flush-clear.cache" value="Drop"/>
Example 5-26 shows how to use this extension in a property map
Example 5-26 Using flush-clear.cache in a Property Map
import org.eclipse.persistence.config.PersistenceUnitProperties;propertiesMap.put(PersistenceUnitProperties.FLUSH_CLEAR_CACHE, FlushClearCache.Drop);
See Also
For more information, see:
"Cache Coordination" in Understanding EclipseLink
"Scaling EclipseLink Applications in Clusters" in Solutions Guide for EclispeLink
Cache Coordination Examples
http://wiki.eclipse.org/EclipseLink/Examples/JPA/CacheCoordination
"Clustering and Cache Coordination"
http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Caching/Coordination