Use eclipselink.flush-clear.cache
to specify the TopLink EntityManager
cache behavior when a clear
method follows the flush
method.
Table 5-36 describes this persistence property's values.
Table 5-36 Valid Values for flush-clear.cache
Value | Description |
---|---|
|
TopLink 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. |
|
TopLink drops the entire This mode is slower than |
|
TopLink 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. |
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.
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);
For more information, see:
"Cache Coordination" in Understanding Oracle TopLink
"Scaling TopLink Applications in Clusters" in Solutions Guide for Oracle TopLink