Class CachePolicy

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public class CachePolicy
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.Serializable

    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:
    ClassDescriptor, Serialized Form
    • Field Detail

      • identityMapClass

        protected java.lang.Class identityMapClass
      • identityMapSize

        protected int identityMapSize
      • shouldAlwaysRefreshCache

        protected boolean shouldAlwaysRefreshCache
      • shouldOnlyRefreshCacheIfNewerVersion

        protected boolean shouldOnlyRefreshCacheIfNewerVersion
      • shouldDisableCacheHits

        protected boolean shouldDisableCacheHits
      • remoteIdentityMapClass

        protected java.lang.Class remoteIdentityMapClass
      • remoteIdentityMapSize

        protected int remoteIdentityMapSize
      • shouldAlwaysRefreshCacheOnRemote

        protected boolean shouldAlwaysRefreshCacheOnRemote
      • shouldDisableCacheHitsOnRemote

        protected boolean shouldDisableCacheHitsOnRemote
      • cacheSynchronizationType

        protected int cacheSynchronizationType
        Configures 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:
        Constant Field Values
      • INVALIDATE_CHANGED_OBJECTS

        public static final int INVALIDATE_CHANGED_OBJECTS
        See Also:
        Constant Field Values
      • SEND_NEW_OBJECTS_WITH_CHANGES

        public static final int SEND_NEW_OBJECTS_WITH_CHANGES
        See Also:
        Constant Field Values
      • unitOfWorkCacheIsolationLevel

        protected int unitOfWorkCacheIsolationLevel
        Configures how the unit of work uses the session cache.
      • wasDefaultUnitOfWorkCacheIsolationLevel

        protected boolean wasDefaultUnitOfWorkCacheIsolationLevel
      • USE_SESSION_CACHE_AFTER_TRANSACTION

        public static final int USE_SESSION_CACHE_AFTER_TRANSACTION
        See Also:
        Constant Field Values
      • ISOLATE_NEW_DATA_AFTER_TRANSACTION

        public static final int ISOLATE_NEW_DATA_AFTER_TRANSACTION
        See Also:
        Constant Field Values
      • ISOLATE_CACHE_AFTER_TRANSACTION

        public static final int ISOLATE_CACHE_AFTER_TRANSACTION
        See Also:
        Constant Field Values
      • ISOLATE_FROM_CLIENT_SESSION

        public static final int ISOLATE_FROM_CLIENT_SESSION
        See Also:
        Constant Field Values
      • cacheKeyType

        protected CacheKeyType cacheKeyType
        Allow cache key type to be configured.
      • cacheInterceptorClass

        protected java.lang.Class cacheInterceptorClass
      • cacheInterceptorClassName

        protected java.lang.String cacheInterceptorClassName
      • fullyMergeEntity

        protected boolean fullyMergeEntity
        This flag controls how the MergeManager should merge an Entity when merging into the shared cache.
      • prefetchCacheKeys

        protected boolean prefetchCacheKeys
        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. Set this flag to true to prefetch the results.
      • cacheIndexes

        protected java.util.Map<java.util.List<org.eclipse.persistence.internal.helper.DatabaseField>,​CacheIndex> cacheIndexes
      • databaseChangeNotificationType

        protected DatabaseChangeNotificationType databaseChangeNotificationType
        Allows configuration of database change event notification.
    • Constructor Detail

      • CachePolicy

        public CachePolicy()
        PUBLIC: Return a new descriptor.
    • Method Detail

      • getDatabaseChangeNotificationType

        public DatabaseChangeNotificationType 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,
                                         org.eclipse.persistence.internal.sessions.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,
                                   org.eclipse.persistence.internal.sessions.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,
                               org.eclipse.persistence.internal.sessions.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 CacheIndex getCacheIndex​(java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> fields)
        PUBLIC: Return the cache index for the field names.
      • addCacheIndex

        public void addCacheIndex​(CacheIndex index)
        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 void addCacheIndex​(java.lang.String... fields)
        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 void addCacheIndex​(org.eclipse.persistence.internal.helper.DatabaseField[] fields)
        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

        public java.util.Map<java.util.List<org.eclipse.persistence.internal.helper.DatabaseField>,​CacheIndex> getCacheIndexes()
      • setCacheIndexes

        public void setCacheIndexes​(java.util.Map<java.util.List<org.eclipse.persistence.internal.helper.DatabaseField>,​CacheIndex> cacheIndexes)
      • clone

        public CachePolicy clone()
        Overrides:
        clone in class java.lang.Object
      • assignDefaultValues

        public void assignDefaultValues​(org.eclipse.persistence.internal.sessions.AbstractSession session)
        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

        public void convertClassNamesToClasses​(java.lang.ClassLoader classLoader)
        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.
        Parameters:
        classLoader -
      • getFullyMergeEntity

        public boolean getFullyMergeEntity()
        Returns:
        the fullyMergeEntity
      • setCacheKeyType

        public void setCacheKeyType​(CacheKeyType cacheKeyType)
        ADVANCED: Set what cache key type to use to store the object in the cache.
      • getCacheKeyType

        public CacheKeyType getCacheKeyType()
        ADVANCED: Return what cache key type to use to store the object in the cache.
      • getCacheInterceptorClass

        public java.lang.Class 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:
        CacheInterceptor
      • getCacheInterceptorClassName

        public java.lang.String 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:
        CacheInterceptor
      • 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

        public java.lang.Class 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

        public java.lang.Class 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:
        ClassDescriptor.disableCacheHits()
      • 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:
        ClassDescriptor.disableCacheHitsOnRemote()
      • shouldOnlyRefreshCacheIfNewerVersion

        public boolean shouldOnlyRefreshCacheIfNewerVersion()
        PUBLIC: This method returns true if the ClassDescriptor 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 returns false.
        See Also:
        setShouldOnlyRefreshCacheIfNewerVersion(boolean)
      • shouldAlwaysRefreshCache

        public boolean shouldAlwaysRefreshCache()
        PUBLIC: This method returns true if the ClassDescriptor is configured to always refresh the cache if data is received from the database by any query. Otherwise, it returns false.
        See Also:
        setShouldAlwaysRefreshCache(boolean)
      • shouldAlwaysRefreshCacheOnRemote

        public boolean shouldAlwaysRefreshCacheOnRemote()
        PUBLIC: This method returns true if the ClassDescriptor is configured to always remotely refresh the cache if data is received from the database by any query in a RemoteSession. Otherwise, it returns false.
        See Also:
        setShouldAlwaysRefreshCacheOnRemote(boolean)
      • setShouldDisableCacheHits

        public void setShouldDisableCacheHits​(boolean shouldDisableCacheHits)
        PUBLIC: Set if cache hits on primary key read object queries should be disabled.
        See Also:
        ClassDescriptor.alwaysRefreshCache()
      • 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:
        ClassDescriptor.disableCacheHitsOnRemote()
      • setShouldOnlyRefreshCacheIfNewerVersion

        public void setShouldOnlyRefreshCacheIfNewerVersion​(boolean shouldOnlyRefreshCacheIfNewerVersion)
        PUBLIC: When the shouldOnlyRefreshCacheIfNewerVersion argument passed into this method is true, this method configures a ClassDescriptor 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:

        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 is false, this method ensures that a ClassDescriptor 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:
        ClassDescriptor.onlyRefreshCacheIfNewerVersion(), ClassDescriptor.dontOnlyRefreshCacheIfNewerVersion()
      • setShouldAlwaysRefreshCache

        public void setShouldAlwaysRefreshCache​(boolean shouldAlwaysRefreshCache)
        PUBLIC: When the shouldAlwaysRefreshCache argument passed into this method is true, this method configures a ClassDescriptor 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 with ClassDescriptor.onlyRefreshCacheIfNewerVersion().

        When the shouldAlwaysRefreshCache argument passed into this method is false, this method ensures that a ClassDescriptor is not configured to always refresh the cache if data is received from the database by any query.

        See Also:
        ClassDescriptor.alwaysRefreshCache(), ClassDescriptor.dontAlwaysRefreshCache()
      • setShouldAlwaysRefreshCacheOnRemote

        public void setShouldAlwaysRefreshCacheOnRemote​(boolean shouldAlwaysRefreshCacheOnRemote)
        PUBLIC: When the shouldAlwaysRefreshCacheOnRemote argument passed into this method is true, this method configures a ClassDescriptor to always remotely refresh the cache if data is received from the database by any query in a RemoteSession. 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.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 with ClassDescriptor.onlyRefreshCacheIfNewerVersion().

        When the shouldAlwaysRefreshCacheOnRemote argument passed into this method is false, this method ensures that a ClassDescriptor is not configured to always remotely refresh the cache if data is received from the database by any query in a RemoteSession.

        See Also:
        ClassDescriptor.alwaysRefreshCacheOnRemote(), ClassDescriptor.dontAlwaysRefreshCacheOnRemote()
      • setRemoteIdentityMapClass

        public void setRemoteIdentityMapClass​(java.lang.Class theIdentityMapClass)
        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

        public void setCacheable​(java.lang.Boolean cacheable)
        INTERNAL: Set entity @Cacheable annotation value.
        Parameters:
        cacheable - Entity @Cacheable annotation value for current class or null if @Cacheable annotation is not set. Parent values are ignored, value shall refer to current class only.
      • getCacheIsolation

        public CacheIsolationType getCacheIsolation()
        PUBLIC: Controls how the Entity instances will be cached. See the CacheIsolationType for details on the options.
        Returns:
        the isolationType
      • setCacheIsolation

        public void setCacheIsolation​(CacheIsolationType isolationType)
        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(int)
      • 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 void setIdentityMapClass​(java.lang.Class theIdentityMapClass)
        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
        Note: Cache Synchronization type cannot be altered for descriptors that are set as isolated using the setIsIsolated method.

        This has been replaced by setCacheCoordinationType().

        Parameters:
        type - int The synchronization type for this descriptor
        See Also:
        setCacheCoordinationType(CacheCoordinationType)
      • setCacheCoordinationType

        public void setCacheCoordinationType​(CacheCoordinationType type)
        PUBLIC: Set the type of cache coordination that will be used on objects of this type. Valid values defined in CacheCoordinationType.
      • setCacheInterceptorClass

        public void setCacheInterceptorClass​(java.lang.Class 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. 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:
        CacheInterceptor
      • setCacheInterceptorClassName

        public void setCacheInterceptorClassName​(java.lang.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. 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:
        CacheInterceptor
      • 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.
      • isSharedIsolation

        public boolean isSharedIsolation()
        PUBLIC: Returns true if the descriptor represents a shared class.
      • indexObjectInCache

        public void indexObjectInCache​(org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey,
                                       org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                       java.lang.Object domainObject,
                                       ClassDescriptor descriptor,
                                       org.eclipse.persistence.internal.sessions.AbstractSession session,
                                       boolean refresh)
        INTERNAL: Index the object by index in the cache using its row.
      • indexObjectInCache

        public void indexObjectInCache​(org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey,
                                       java.lang.Object object,
                                       ClassDescriptor descriptor,
                                       org.eclipse.persistence.internal.sessions.AbstractSession session,
                                       boolean refresh)
        INTERNAL: Index the object by index in the cache using the object.
      • indexObjectInCache

        public void indexObjectInCache​(org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet,
                                       java.lang.Object object,
                                       ClassDescriptor descriptor,
                                       org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Index the object by index in the cache using its changeSet.
      • checkCacheByIndex

        public org.eclipse.persistence.internal.identitymaps.CacheKey checkCacheByIndex​(Expression expression,
                                                                                        org.eclipse.persistence.internal.sessions.AbstractRecord translationRow,
                                                                                        ClassDescriptor descriptor,
                                                                                        org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Lookup the expression in the cache if it contains any indexes.
      • isIndexableExpression

        public boolean isIndexableExpression​(Expression expression,
                                             ClassDescriptor descriptor,
                                             org.eclipse.persistence.internal.sessions.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:
        ClassDescriptor.setIsIsolated(boolean)
      • 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()