- All Implemented Interfaces:
Serializable
,Cloneable
Purpose:
CachePolicy defines the cache configuration.
EclipseLink supports an integrated shared (L2) object cache.
Caching is enabled by default.
To disable caching use:
setCacheIsolation(CacheIsolationType.ISOLATED)
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected Map
<List<DatabaseField>, CacheIndex> protected Class
<? extends CacheInterceptor> protected String
protected CacheIsolationType
protected CacheKeyType
Allow cache key type to be configured.protected int
Configures how objects will be sent via cache synchronization, if synchronization is enabled.protected DatabaseChangeNotificationType
Allows configuration of database change event notification.static final int
protected boolean
This flag controls how the MergeManager should merge an Entity when merging into the shared cache.protected Class
<? extends IdentityMap> protected int
static final int
static final int
static final int
static final int
static final int
protected boolean
In certain cases and cache types it is more efficient to preFetch the cache keys from the cache when building the results of the query.protected Class
<? extends IdentityMap> protected int
static final int
static final int
protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
static final int
static final int
protected int
Configures how the unit of work uses the session cache.static final int
protected boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCacheIndex
(String... fields) PUBLIC: Add the cache index to the descriptor's cache settings.void
addCacheIndex
(CacheIndex index) PUBLIC: Add the cache index to the descriptor's cache settings.void
addCacheIndex
(DatabaseField[] fields) PUBLIC: Add the cache index to the descriptor's cache settings.void
assignDefaultValues
(AbstractSession session) INTERNAL: Some attributes have default values defined in Project.checkCacheByIndex
(Expression expression, AbstractRecord translationRow, ClassDescriptor descriptor, AbstractSession session) INTERNAL: Lookup the expression in the cache if it contains any indexes.clone()
void
convertClassNamesToClasses
(ClassLoader classLoader) INTERNAL: Convert all the class-name-based settings in this Descriptor to actual class-based settings.getCacheIndex
(List<DatabaseField> fields) PUBLIC: Return the cache index for the field names.<T extends CacheInterceptor>
Class<T> A CacheInterceptor is an adaptor that when overridden and assigned to a Descriptor all interaction between EclipseLink and the internal cache for that class will pass through the Interceptor.A CacheInterceptor is an adaptor that when overridden and assigned to a Descriptor all interaction between EclipseLink and the internal cache for that class will pass through the Interceptor.PUBLIC: Controls how the Entity instances will be cached.ADVANCED: Return what cache key type to use to store the object in the cache.int
PUBLIC: Get a value indicating the type of cache synchronization that will be used on objects of this type.Returns what type of database change notification an entity/descriptor should use.boolean
<T extends IdentityMap>
Class<T> INTERNAL: Return the class of identity map to be used by this descriptor.int
PUBLIC: Return the size of the identity map.<T extends IdentityMap>
Class<T> INTERNAL: Return the class of identity map to be used by this descriptor.int
PUBLIC: Return the size of the remote identity map.int
ADVANCED: Return the unit of work cache isolation setting.boolean
void
indexObjectInCache
(CacheKey cacheKey, Object object, ClassDescriptor descriptor, AbstractSession session, boolean refresh) INTERNAL: Index the object by index in the cache using the object.void
indexObjectInCache
(CacheKey cacheKey, AbstractRecord databaseRow, Object domainObject, ClassDescriptor descriptor, AbstractSession session, boolean refresh) INTERNAL: Index the object by index in the cache using its row.void
indexObjectInCache
(ObjectChangeSet changeSet, Object object, ClassDescriptor descriptor, AbstractSession session) INTERNAL: Index the object by index in the cache using its changeSet.void
initialize
(ClassDescriptor descriptor, AbstractSession session) INTERNAL: Allow the inheritance properties of the descriptor to be initialized.void
initializeFromParent
(CachePolicy parentPolicy, ClassDescriptor descriptor, ClassDescriptor descriptorDescriptor, AbstractSession session) INTERNAL: Allow the inheritance properties of the descriptor to be initialized.boolean
isIndexableExpression
(Expression expression, ClassDescriptor descriptor, AbstractSession session) INTERNAL: Lookup the expression in the cache if it contains any indexes.boolean
PUBLIC: Returns true if the descriptor represents an isolated classboolean
PUBLIC: Returns true if the descriptor represents a protected class.boolean
PUBLIC: Returns true if the descriptor represents a shared class.void
postInitialize
(ClassDescriptor descriptor, AbstractSession session) INTERNAL: Initialize the cache isolation setting.void
setCacheable
(Boolean cacheable) INTERNAL: Set entity @Cacheable annotation value.void
PUBLIC: Set the type of cache coordination that will be used on objects of this type.void
setCacheIndexes
(Map<List<DatabaseField>, CacheIndex> cacheIndexes) void
setCacheInterceptorClass
(Class<? extends CacheInterceptor> cacheInterceptorClass) PUBLIC: A CacheInterceptor is an adaptor that when overridden and assigned to a Descriptor all interaction between EclipseLink and the internal cache for that class will pass through the Interceptor.void
setCacheInterceptorClassName
(String cacheInterceptorClassName) PUBLIC: A CacheInterceptor is an adaptor that when overridden and assigned to a Descriptor all interaction between EclipseLink and the internal cache for that class will pass through the Interceptor.void
setCacheIsolation
(CacheIsolationType isolationType) PUBLIC: Controls how the Entity instances and data will be cached.void
setCacheKeyType
(CacheKeyType cacheKeyType) ADVANCED: Set what cache key type to use to store the object in the cache.void
setCacheSynchronizationType
(int type) OBSOLETE: Set the type of cache coordination that will be used on objects of this type.void
setDatabaseChangeNotificationType
(DatabaseChangeNotificationType databaseChangeNotificationType) Configures what type of database change notification an entity/descriptor should use.void
setFullyMergeEntity
(boolean fullyMergeEntity) void
setIdentityMapClass
(Class<? extends IdentityMap> theIdentityMapClass) PUBLIC: Set the class of identity map to be used by this descriptor.void
setIdentityMapSize
(int identityMapSize) PUBLIC: Set the size of the identity map to be used by this descriptor.void
setPrefetchCacheKeys
(boolean prefetchCacheKeys) void
setRemoteIdentityMapClass
(Class<? extends IdentityMap> theIdentityMapClass) PUBLIC: Set the class of identity map to be used by this descriptor.void
setRemoteIdentityMapSize
(int identityMapSize) PUBLIC: Set the size of the identity map to be used by this descriptor.void
setShouldAlwaysRefreshCache
(boolean shouldAlwaysRefreshCache) PUBLIC: When theshouldAlwaysRefreshCache
argument passed into this method istrue
, this method configures aClassDescriptor
to always refresh the cache if data is received from the database by any query.void
setShouldAlwaysRefreshCacheOnRemote
(boolean shouldAlwaysRefreshCacheOnRemote) PUBLIC: When theshouldAlwaysRefreshCacheOnRemote
argument passed into this method istrue
, this method configures aClassDescriptor
to always remotely refresh the cache if data is received from the database by any query in aRemoteSession
.void
setShouldDisableCacheHits
(boolean shouldDisableCacheHits) PUBLIC: Set if cache hits on primary key read object queries should be disabled.void
setShouldDisableCacheHitsOnRemote
(boolean shouldDisableCacheHitsOnRemote) PUBLIC: Set if the remote session cache hits on primary key read object queries is allowed or not.void
setShouldOnlyRefreshCacheIfNewerVersion
(boolean shouldOnlyRefreshCacheIfNewerVersion) PUBLIC: When theshouldOnlyRefreshCacheIfNewerVersion
argument passed into this method istrue
, this method configures aClassDescriptor
to only refresh the cache if the data received from the database by a query is newer than the data in the cache (as determined by the optimistic locking field) and as long as one of the following is true: theClassDescriptor
was configured by callingClassDescriptor.alwaysRefreshCache()
orClassDescriptor.alwaysRefreshCacheOnRemote()
, the query was configured by callingObjectLevelReadQuery.refreshIdentityMapResult()
, or the query was a call toSession.refreshObject(java.lang.Object)
void
setUnitOfWorkCacheIsolationLevel
(int unitOfWorkCacheIsolationLevel) ADVANCED: This setting configures how the session cache will be used in a unit of work.boolean
PUBLIC: This method returnstrue
if theClassDescriptor
is configured to always refresh the cache if data is received from the database by any query.boolean
PUBLIC: This method returnstrue
if theClassDescriptor
is configured to always remotely refresh the cache if data is received from the database by any query in aRemoteSession
.boolean
PUBLIC: Return if for cache hits on primary key read object queries to be disabled.boolean
PUBLIC: Return if the remote server session cache hits on primary key read object queries is aloowed or not.boolean
INTERNAL: Return if the unit of work should by-pass the session cache.boolean
INTERNAL: Return if the unit of work should by-pass the session cache after an early transaction.boolean
INTERNAL: Return if the unit of work should by-pass the IsolatedSession cache.boolean
PUBLIC: This method returnstrue
if theClassDescriptor
is configured to only refresh the cache if the data received from the database by a query is newer than the data in the cache (as determined by the optimistic locking field).boolean
boolean
INTERNAL: Return if the unit of work should use the session cache after an early transaction.void
PUBLIC: Set the class of identity map to be the full identity map.void
PUBLIC: Set the class of identity map to be the hard cache weak identity map.void
PUBLIC: Set the class of identity map to be the no identity map.void
PUBLIC: Set the class of identity map to be the soft identity map.void
PUBLIC: Set the class of identity map to be the weak identity map.
-
Field Details
-
identityMapClass
-
identityMapSize
protected int identityMapSize -
shouldAlwaysRefreshCache
protected boolean shouldAlwaysRefreshCache -
shouldOnlyRefreshCacheIfNewerVersion
protected boolean shouldOnlyRefreshCacheIfNewerVersion -
shouldDisableCacheHits
protected boolean shouldDisableCacheHits -
remoteIdentityMapClass
-
remoteIdentityMapSize
protected int remoteIdentityMapSize -
shouldAlwaysRefreshCacheOnRemote
protected boolean shouldAlwaysRefreshCacheOnRemote -
shouldDisableCacheHitsOnRemote
protected boolean shouldDisableCacheHitsOnRemote -
cacheIsolation
-
cacheSynchronizationType
protected int cacheSynchronizationTypeConfigures how objects will be sent via cache synchronization, if synchronization is enabled. -
UNDEFINED_OBJECT_CHANGE_BEHAVIOR
public static final int UNDEFINED_OBJECT_CHANGE_BEHAVIOR- See Also:
-
SEND_OBJECT_CHANGES
public static final int SEND_OBJECT_CHANGES- See Also:
-
INVALIDATE_CHANGED_OBJECTS
public static final int INVALIDATE_CHANGED_OBJECTS- See Also:
-
SEND_NEW_OBJECTS_WITH_CHANGES
public static final int SEND_NEW_OBJECTS_WITH_CHANGES- See Also:
-
DO_NOT_SEND_CHANGES
public static final int DO_NOT_SEND_CHANGES- See Also:
-
unitOfWorkCacheIsolationLevel
protected int unitOfWorkCacheIsolationLevelConfigures how the unit of work uses the session cache. -
wasDefaultUnitOfWorkCacheIsolationLevel
protected boolean wasDefaultUnitOfWorkCacheIsolationLevel -
UNDEFINED_ISOLATATION
public static final int UNDEFINED_ISOLATATION- See Also:
-
USE_SESSION_CACHE_AFTER_TRANSACTION
public static final int USE_SESSION_CACHE_AFTER_TRANSACTION- See Also:
-
ISOLATE_NEW_DATA_AFTER_TRANSACTION
public static final int ISOLATE_NEW_DATA_AFTER_TRANSACTION- See Also:
-
ISOLATE_CACHE_AFTER_TRANSACTION
public static final int ISOLATE_CACHE_AFTER_TRANSACTION- See Also:
-
ISOLATE_FROM_CLIENT_SESSION
public static final int ISOLATE_FROM_CLIENT_SESSION- See Also:
-
ISOLATE_CACHE_ALWAYS
public static final int ISOLATE_CACHE_ALWAYS- See Also:
-
cacheKeyType
Allow cache key type to be configured. -
cacheInterceptorClass
-
cacheInterceptorClassName
-
fullyMergeEntity
protected boolean fullyMergeEntityThis flag controls how the MergeManager should merge an Entity when merging into the shared cache. -
prefetchCacheKeys
protected boolean prefetchCacheKeysIn certain cases and cache types it is more efficient to preFetch the cache keys from the cache when building the results of the query. Set this flag to true to prefetch the results. -
cacheIndexes
-
databaseChangeNotificationType
Allows configuration of database change event notification.
-
-
Constructor Details
-
CachePolicy
public CachePolicy()PUBLIC: Return a new descriptor.
-
-
Method Details
-
getDatabaseChangeNotificationType
Returns what type of database change notification an entity/descriptor should use. This is only relevant if the persistence unit/session has been configured with a DatabaseEventListener, such as the OracleChangeNotificationListener that receives database change events. This allows for the EclipseLink cache to be invalidated or updated from database changes. -
setDatabaseChangeNotificationType
public void setDatabaseChangeNotificationType(DatabaseChangeNotificationType databaseChangeNotificationType) Configures what type of database change notification an entity/descriptor should use. This is only relevant if the persistence unit/session has been configured with a DatabaseEventListener, such as the OracleChangeNotificationListener that receives database change events. This allows for the EclipseLink cache to be invalidated or updated from database changes. -
initializeFromParent
public void initializeFromParent(CachePolicy parentPolicy, ClassDescriptor descriptor, ClassDescriptor descriptorDescriptor, AbstractSession session) throws DescriptorException INTERNAL: Allow the inheritance properties of the descriptor to be initialized. The descriptor's parent must first be initialized.- Throws:
DescriptorException
-
postInitialize
public void postInitialize(ClassDescriptor descriptor, AbstractSession session) throws DescriptorException INTERNAL: Initialize the cache isolation setting. This may need to be called multiple times as notifyReferencingDescriptorsOfIsolation() can change the cache isolation.- Throws:
DescriptorException
-
initialize
public void initialize(ClassDescriptor descriptor, AbstractSession session) throws DescriptorException INTERNAL: Allow the inheritance properties of the descriptor to be initialized. The descriptor's parent must first be initialized.- Throws:
DescriptorException
-
getCacheIndex
PUBLIC: Return the cache index for the field names. -
addCacheIndex
PUBLIC: Add the cache index to the descriptor's cache settings. This allows for cache hits to be obtained on non-primary key fields. The primary key is always indexed in the cache. Cache indexes are defined by their database column names. -
addCacheIndex
PUBLIC: Add the cache index to the descriptor's cache settings. This allows for cache hits to be obtained on non-primary key fields. The primary key is always indexed in the cache. Cache indexes are defined by their database column names. -
addCacheIndex
PUBLIC: Add the cache index to the descriptor's cache settings. This allows for cache hits to be obtained on non-primary key fields. The primary key is always indexed in the cache. Cache indexes are defined by their database column names. -
hasCacheIndexes
public boolean hasCacheIndexes() -
getCacheIndexes
-
setCacheIndexes
-
clone
-
assignDefaultValues
INTERNAL: Some attributes have default values defined in Project. If such the value for the attribute hasn't been set then the default value is assigned. -
convertClassNamesToClasses
INTERNAL: Convert all the class-name-based settings in this Descriptor to actual class-based settings. This method is used when converting a project that has been built with class names to a project with classes. -
getFullyMergeEntity
public boolean getFullyMergeEntity()- Returns:
- the fullyMergeEntity
-
setCacheKeyType
ADVANCED: Set what cache key type to use to store the object in the cache. -
getCacheKeyType
ADVANCED: Return what cache key type to use to store the object in the cache. -
getCacheInterceptorClass
A CacheInterceptor is an adaptor that when overridden and assigned to a Descriptor all interaction between EclipseLink and the internal cache for that class will pass through the Interceptor. Advanced users could use this interceptor to audit, profile or log cache access. This Interceptor could also be used to redirect or augment the TopLink cache with an alternate cache mechanism. EclipseLink's configurated IdentityMaps will be passed to the Interceptor constructor. As with IdentityMaps an entire class inheritance hierarchy will share the same interceptor.- See Also:
-
getCacheInterceptorClassName
A CacheInterceptor is an adaptor that when overridden and assigned to a Descriptor all interaction between EclipseLink and the internal cache for that class will pass through the Interceptor. Advanced users could use this interceptor to audit, profile or log cache access. This Interceptor could also be used to redirect or augment the TopLink cache with an alternate cache mechanism. EclipseLink's configurated IdentityMaps will be passed to the Interceptor constructor. As with IdentityMaps an entire class inheritance hierarchy will share the same interceptor.- See Also:
-
getCacheSynchronizationType
public int getCacheSynchronizationType()PUBLIC: Get a value indicating the type of cache synchronization that will be used on objects of this type. Possible values are: SEND_OBJECT_CHANGES INVALIDATE_CHANGED_OBJECTS SEND_NEW_OBJECTS+WITH_CHANGES DO_NOT_SEND_CHANGES- Returns:
- int
-
getIdentityMapClass
INTERNAL: Return the class of identity map to be used by this descriptor. The default is the "SoftCacheWeakIdentityMap". -
getIdentityMapSize
public int getIdentityMapSize()PUBLIC: Return the size of the identity map. -
getRemoteIdentityMapClass
INTERNAL: Return the class of identity map to be used by this descriptor. The default is the "SoftCacheWeakIdentityMap". -
getRemoteIdentityMapSize
public int getRemoteIdentityMapSize()PUBLIC: Return the size of the remote identity map. -
shouldDisableCacheHits
public boolean shouldDisableCacheHits()PUBLIC: Return if for cache hits on primary key read object queries to be disabled.- See Also:
-
shouldDisableCacheHitsOnRemote
public boolean shouldDisableCacheHitsOnRemote()PUBLIC: Return if the remote server session cache hits on primary key read object queries is aloowed or not.- See Also:
-
shouldOnlyRefreshCacheIfNewerVersion
public boolean shouldOnlyRefreshCacheIfNewerVersion()PUBLIC: This method returnstrue
if theClassDescriptor
is configured to only refresh the cache if the data received from the database by a query is newer than the data in the cache (as determined by the optimistic locking field). Otherwise, it returnsfalse
.- See Also:
-
shouldAlwaysRefreshCache
public boolean shouldAlwaysRefreshCache()PUBLIC: This method returnstrue
if theClassDescriptor
is configured to always refresh the cache if data is received from the database by any query. Otherwise, it returnsfalse
.- See Also:
-
shouldAlwaysRefreshCacheOnRemote
public boolean shouldAlwaysRefreshCacheOnRemote()PUBLIC: This method returnstrue
if theClassDescriptor
is configured to always remotely refresh the cache if data is received from the database by any query in aRemoteSession
. Otherwise, it returnsfalse
.- See Also:
-
setShouldDisableCacheHits
public void setShouldDisableCacheHits(boolean shouldDisableCacheHits) PUBLIC: Set if cache hits on primary key read object queries should be disabled.- See Also:
-
setShouldDisableCacheHitsOnRemote
public void setShouldDisableCacheHitsOnRemote(boolean shouldDisableCacheHitsOnRemote) PUBLIC: Set if the remote session cache hits on primary key read object queries is allowed or not.- See Also:
-
setShouldOnlyRefreshCacheIfNewerVersion
public void setShouldOnlyRefreshCacheIfNewerVersion(boolean shouldOnlyRefreshCacheIfNewerVersion) PUBLIC: When theshouldOnlyRefreshCacheIfNewerVersion
argument passed into this method istrue
, this method configures aClassDescriptor
to only refresh the cache if the data received from the database by a query is newer than the data in the cache (as determined by the optimistic locking field) and as long as one of the following is true:- the
ClassDescriptor
was configured by callingClassDescriptor.alwaysRefreshCache()
orClassDescriptor.alwaysRefreshCacheOnRemote()
, - the query was configured by calling
ObjectLevelReadQuery.refreshIdentityMapResult()
, or - the query was a call to
Session.refreshObject(java.lang.Object)
However, if a query hits the cache, data is not refreshed regardless of how this setting is configured. For example, by default, when a query for a single object based on its primary key is executed, OracleAS TopLink will first look in the cache for the object. If the object is in the cache, the cached object is returned and data is not refreshed. To avoid cache hits, use the
ClassDescriptor.disableCacheHits()
method.Also note that the
UnitOfWork
will not refresh its registered objects.When the
shouldOnlyRefreshCacheIfNewerVersion
argument passed into this method isfalse
, this method ensures that aClassDescriptor
is not configured to only refresh the cache if the data received from the database by a query is newer than the data in the cache (as determined by the optimistic locking field).- See Also:
- the
-
setShouldAlwaysRefreshCache
public void setShouldAlwaysRefreshCache(boolean shouldAlwaysRefreshCache) PUBLIC: When theshouldAlwaysRefreshCache
argument passed into this method istrue
, this method configures aClassDescriptor
to always refresh the cache if data is received from the database by any query.However, if a query hits the cache, data is not refreshed regardless of how this setting is configured. For example, by default, when a query for a single object based on its primary key is executed, OracleAS TopLink will first look in the cache for the object. If the object is in the cache, the cached object is returned and data is not refreshed. To avoid cache hits, use the
ClassDescriptor.disableCacheHits()
method.Also note that the
UnitOfWork
will not refresh its registered objects.Use this property with caution because it can lead to poor performance and may refresh on queries when it is not desired. Normally, if you require fresh data, it is better to configure a query with
ObjectLevelReadQuery.refreshIdentityMapResult()
. To ensure that refreshes are only done when required, use this method in conjunction withClassDescriptor.onlyRefreshCacheIfNewerVersion()
.When the
shouldAlwaysRefreshCache
argument passed into this method isfalse
, this method ensures that aClassDescriptor
is not configured to always refresh the cache if data is received from the database by any query.- See Also:
-
setShouldAlwaysRefreshCacheOnRemote
public void setShouldAlwaysRefreshCacheOnRemote(boolean shouldAlwaysRefreshCacheOnRemote) PUBLIC: When theshouldAlwaysRefreshCacheOnRemote
argument passed into this method istrue
, this method configures aClassDescriptor
to always remotely refresh the cache if data is received from the database by any query in aRemoteSession
. However, if a query hits the cache, data is not refreshed regardless of how this setting is configured. For example, by default, when a query for a single object based on its primary key is executed, OracleAS TopLink will first look in the cache for the object. If the object is in the cache, the cached object is returned and data is not refreshed. To avoid cache hits, use theClassDescriptor.disableCacheHitsOnRemote()
method.Also note that the
UnitOfWork
will not refresh its registered objects.Use this property with caution because it can lead to poor performance and may refresh on queries when it is not desired. Normally, if you require fresh data, it is better to configure a query with
ObjectLevelReadQuery.refreshIdentityMapResult()
. To ensure that refreshes are only done when required, use this method in conjunction withClassDescriptor.onlyRefreshCacheIfNewerVersion()
.When the
shouldAlwaysRefreshCacheOnRemote
argument passed into this method isfalse
, this method ensures that aClassDescriptor
is not configured to always remotely refresh the cache if data is received from the database by any query in aRemoteSession
.- See Also:
-
setRemoteIdentityMapClass
PUBLIC: Set the class of identity map to be used by this descriptor. The default is the "FullIdentityMap". -
setRemoteIdentityMapSize
public void setRemoteIdentityMapSize(int identityMapSize) PUBLIC: Set the size of the identity map to be used by this descriptor. The default is the 100. -
setCacheable
INTERNAL: Set entity @Cacheable annotation value.- Parameters:
cacheable
- Entity @Cacheable annotation value for current class ornull
if @Cacheable annotation is not set. Parent values are ignored, value shall refer to current class only.
-
getCacheIsolation
PUBLIC: Controls how the Entity instances will be cached. See the CacheIsolationType for details on the options.- Returns:
- the isolationType
-
setCacheIsolation
PUBLIC: Controls how the Entity instances and data will be cached. See the CacheIsolationType for details on the options. To disable all second level caching simply set CacheIsolationType.ISOLATED. Note that setting the isolation will automatically set the corresponding cacheSynchronizationType. ISOLATED = DO_NOT_SEND_CHANGES, PROTECTED and SHARED = SEND_OBJECT_CHANGES -
shouldIsolateObjectsInUnitOfWork
public boolean shouldIsolateObjectsInUnitOfWork()INTERNAL: Return if the unit of work should by-pass the session cache. Objects will be built in the unit of work, and never merged into the session cache. -
shouldIsolateProtectedObjectsInUnitOfWork
public boolean shouldIsolateProtectedObjectsInUnitOfWork()INTERNAL: Return if the unit of work should by-pass the IsolatedSession cache. Objects will be built/merged into the unit of work and into the session cache. but not built/merge into the IsolatedClientSession cache. -
shouldIsolateObjectsInUnitOfWorkEarlyTransaction
public boolean shouldIsolateObjectsInUnitOfWorkEarlyTransaction()INTERNAL: Return if the unit of work should by-pass the session cache after an early transaction. -
shouldUseSessionCacheInUnitOfWorkEarlyTransaction
public boolean shouldUseSessionCacheInUnitOfWorkEarlyTransaction()INTERNAL: Return if the unit of work should use the session cache after an early transaction. -
getUnitOfWorkCacheIsolationLevel
public int getUnitOfWorkCacheIsolationLevel()ADVANCED: Return the unit of work cache isolation setting. This setting configures how the session cache will be used in a unit of work.- See Also:
-
setUnitOfWorkCacheIsolationLevel
public void setUnitOfWorkCacheIsolationLevel(int unitOfWorkCacheIsolationLevel) ADVANCED: This setting configures how the session cache will be used in a unit of work. Most of the options only apply to a unit of work in an early transaction, such as a unit of work that was flushed (writeChanges), issued a modify query, or acquired a pessimistic lock.USE_SESSION_CACHE_AFTER_TRANSACTION - Objects built from new data accessed after a unit of work early transaction are stored in the session cache. This options is the most efficient as it allows the cache to be used after an early transaction. This should only be used if it is known that this class is not modified in the transaction, otherwise this could cause uncommitted data to be loaded into the session cache. ISOLATE_NEW_DATA_AFTER_TRANSACTION - Default (when using caching): Objects built from new data accessed after a unit of work early transaction are only stored in the unit of work. This still allows previously cached objects to be accessed in the unit of work after an early transaction, but ensures uncommitted data will never be put in the session cache by storing any object built from new data only in the unit of work. ISOLATE_CACHE_AFTER_TRANSACTION - After a unit of work early transaction the session cache is no longer used for this class. Objects will be directly built from the database data and only stored in the unit of work, even if previously cached. Note that this may lead to poor performance as the session cache is bypassed after an early transaction. ISOLATE_CACHE_ALWAYS - Default (when using isolated cache): The session cache will never be used for this class. Objects will be directly built from the database data and only stored in the unit of work. New objects and changes will also never be merged into the session cache. Note that this may lead to poor performance as the session cache is bypassed, however if this class is isolated or pessimistic locked and always accessed in a transaction, this can avoid having to build two copies of the object.
-
setFullyMergeEntity
public void setFullyMergeEntity(boolean fullyMergeEntity) - Parameters:
fullyMergeEntity
- the fullyMergeEntity to set
-
setIdentityMapClass
PUBLIC: Set the class of identity map to be used by this descriptor. The default is the "FullIdentityMap". -
setIdentityMapSize
public void setIdentityMapSize(int identityMapSize) PUBLIC: Set the size of the identity map to be used by this descriptor. The default is the 100. -
setCacheSynchronizationType
public void setCacheSynchronizationType(int type) OBSOLETE: Set the type of cache coordination that will be used on objects of this type. Possible values are:- SEND_OBJECT_CHANGES
- INVALIDATE_CHANGED_OBJECTS
- SEND_NEW_OBJECTS_WITH_CHANGES
- DO_NOT_SEND_CHANGES
This has been replaced by setCacheCoordinationType().
- Parameters:
type
- int The synchronization type for this descriptor- See Also:
-
setCacheCoordinationType
PUBLIC: Set the type of cache coordination that will be used on objects of this type. Valid values defined in CacheCoordinationType. -
setCacheInterceptorClass
PUBLIC: A CacheInterceptor is an adaptor that when overridden and assigned to a Descriptor all interaction between EclipseLink and the internal cache for that class will pass through the Interceptor. Advanced users could use this interceptor to audit, profile or log cache access. This Interceptor could also be used to redirect or augment the TopLink cache with an alternate cache mechanism. EclipseLink's configurated IdentityMaps will be passed to the Interceptor constructor. As with IdentityMaps an entire class inheritance hierarchy will share the same interceptor.- See Also:
-
setCacheInterceptorClassName
PUBLIC: A CacheInterceptor is an adaptor that when overridden and assigned to a Descriptor all interaction between EclipseLink and the internal cache for that class will pass through the Interceptor. Advanced users could use this interceptor to audit, profile or log cache access. This Interceptor could also be used to redirect or augment the TopLink cache with an alternate cache mechanism. EclipseLink's configurated IdentityMaps will be passed to the Interceptor constructor. As with IdentityMaps an entire class inheritance hierarchy will share the same interceptor.- See Also:
-
isIsolated
public boolean isIsolated()PUBLIC: Returns true if the descriptor represents an isolated class -
isProtectedIsolation
public boolean isProtectedIsolation()PUBLIC: Returns true if the descriptor represents a protected class. -
indexObjectInCache
public void indexObjectInCache(CacheKey cacheKey, AbstractRecord databaseRow, Object domainObject, ClassDescriptor descriptor, AbstractSession session, boolean refresh) INTERNAL: Index the object by index in the cache using its row. -
indexObjectInCache
public void indexObjectInCache(CacheKey cacheKey, Object object, ClassDescriptor descriptor, AbstractSession session, boolean refresh) INTERNAL: Index the object by index in the cache using the object. -
indexObjectInCache
public void indexObjectInCache(ObjectChangeSet changeSet, Object object, ClassDescriptor descriptor, AbstractSession session) INTERNAL: Index the object by index in the cache using its changeSet. -
checkCacheByIndex
public CacheKey checkCacheByIndex(Expression expression, AbstractRecord translationRow, ClassDescriptor descriptor, AbstractSession session) INTERNAL: Lookup the expression in the cache if it contains any indexes. -
isIndexableExpression
public boolean isIndexableExpression(Expression expression, ClassDescriptor descriptor, AbstractSession session) INTERNAL: Lookup the expression in the cache if it contains any indexes. -
useFullIdentityMap
public void useFullIdentityMap()PUBLIC: Set the class of identity map to be the full identity map. This map caches all instances read and grows to accomodate them. The default is the "SoftCacheWeakIdentityMap". -
useHardCacheWeakIdentityMap
public void useHardCacheWeakIdentityMap()PUBLIC: Set the class of identity map to be the hard cache weak identity map. This map uses weak references to only cache object in-memory. It also includes a secondary fixed sized hard cache to improve caching performance. This is provided because some Java VM's implement soft references differently. The default is the "SoftCacheWeakIdentityMap". -
useSoftIdentityMap
public void useSoftIdentityMap()PUBLIC: Set the class of identity map to be the soft identity map. This map uses soft references to only cache all object in-memory, until memory is low. Note that "low" is interpreted differently by different JVM's. The default is the "SoftCacheWeakIdentityMap". -
useNoIdentityMap
public void useNoIdentityMap()PUBLIC: Set the class of identity map to be the no identity map. This map does no caching. Note: This map does not maintain object identity. In general if caching is not desired a WeakIdentityMap should be used with an isolated descriptor. The default is the "SoftCacheWeakIdentityMap".- See Also:
-
useWeakIdentityMap
public void useWeakIdentityMap()PUBLIC: Set the class of identity map to be the weak identity map. The default is the "SoftCacheWeakIdentityMap". -
setPrefetchCacheKeys
public void setPrefetchCacheKeys(boolean prefetchCacheKeys) -
shouldPrefetchCacheKeys
public boolean shouldPrefetchCacheKeys()
-