/** * INTERNAL: * Return the class of identity map to be used by this descriptor. * The default is the "SoftCacheWeakIdentityMap". */ public Class getIdentityMapClass() { return getCachePolicy().getIdentityMapClass(); }
/** * INTERNAL: * Return the class of identity map to be used by this descriptor. * The default is the "SoftCacheWeakIdentityMap". */ public Class getRemoteIdentityMapClass() { return getCachePolicy().getRemoteIdentityMapClass(); }
/** * PUBLIC: * Returns true if the descriptor represents an isolated class */ public boolean isProtectedIsolation() { return getCachePolicy().isProtectedIsolation(); }
/** * @param fullyMergeEntity the fullyMergeEntity to set */ public void setFullyMergeEntity(boolean fullyMergeEntity) { getCachePolicy().setFullyMergeEntity(fullyMergeEntity); }
/** * PUBLIC: * Set the class of identity map to be used by this descriptor. * The default is the "FullIdentityMap". */ public void setIdentityMapClass(Class theIdentityMapClass) { getCachePolicy().setIdentityMapClass(theIdentityMapClass); }
/** * PUBLIC: * Set if the remote session cache hits on primary key read object queries is allowed or not. * * @see #disableCacheHitsOnRemote() */ public void setShouldDisableCacheHitsOnRemote(boolean shouldDisableCacheHitsOnRemote) { getCachePolicy().setShouldDisableCacheHitsOnRemote(shouldDisableCacheHitsOnRemote); }
/** * PUBLIC: * This method returns <CODE>true</CODE> if the <CODE>ClassDescriptor</CODE> is configured to always remotely * refresh the cache if data is received from the database by any query in a {@link org.eclipse.persistence.sessions.remote.RemoteSession}. * Otherwise, it returns <CODE>false</CODE>. * * @see #setShouldAlwaysRefreshCacheOnRemote */ public boolean shouldAlwaysRefreshCacheOnRemote() { return getCachePolicy().shouldAlwaysRefreshCacheOnRemote(); }
/** * 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". */ public void useSoftIdentityMap() { getCachePolicy().useSoftIdentityMap(); }
/** * 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 soft cache to improve caching performance. * This is provided because some Java VM's do not implement soft references correctly. * The default is the "SoftCacheWeakIdentityMap". */ public void useRemoteHardCacheWeakIdentityMap() { getCachePolicy().setRemoteIdentityMapClass(ClassConstants.HardCacheWeakIdentityMap_Class); }
/** * 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 */ public int getCacheSynchronizationType() { return getCachePolicy().getCacheSynchronizationType(); }
/** * INTERNAL: * Return the class of identity map to be used by this descriptor. * The default is the "SoftCacheWeakIdentityMap". */ public Class getRemoteIdentityMapClass() { return getCachePolicy().getRemoteIdentityMapClass(); }
/** * 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 */ public void setCacheIsolation(CacheIsolationType isolationType) { getCachePolicy().setCacheIsolation(isolationType); }
/** * PUBLIC: * This method returns <CODE>true</CODE> if the <CODE>ClassDescriptor</CODE> is configured to always refresh * the cache if data is received from the database by any query. Otherwise, it returns <CODE>false</CODE>. * * @see #setShouldAlwaysRefreshCache */ public boolean shouldAlwaysRefreshCache() { return getCachePolicy().shouldAlwaysRefreshCache(); }
/** * 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. */ public boolean shouldIsolateObjectsInUnitOfWork() { return getCachePolicy().shouldIsolateObjectsInUnitOfWork(); }
/** * INTERNAL: * Return if the unit of work should by-pass the session cache after an early transaction. */ public boolean shouldIsolateObjectsInUnitOfWorkEarlyTransaction() { return getCachePolicy().shouldIsolateObjectsInUnitOfWorkEarlyTransaction(); }
/** * INTERNAL: * Return whether this mapping should be traversed when we are locking. */ @Override public boolean isLockableMapping(){ return !(this.usesIndirection()) && !referenceDescriptor.getCachePolicy().isIsolated(); }
/** * INTERNAL: * Return whether this mapping should be traversed when we are locking. */ @Override public boolean isLockableMapping(){ return !(this.usesIndirection()) && !referenceDescriptor.getCachePolicy().isIsolated(); }
/** * INTERNAL: * Create an instance of the composite primary key class for the key object. */ public Object createPrimaryKeyInstanceFromId(Object key, AbstractSession session) { if (this.descriptor.getCachePolicy().getCacheKeyType() == CacheKeyType.CACHE_ID) { return createPrimaryKeyInstanceFromPrimaryKeyValues(session, new int[]{0}, ((CacheId)key).getPrimaryKey()); } else { return createPrimaryKeyInstanceFromPrimaryKeyValues(session, new int[]{0}, key); } }
/** * Index the cache key by the index values. */ @Override public void putCacheKeyByIndex(CacheIndex index, CacheId indexValues, CacheKey cacheKey, ClassDescriptor descriptor) { if (!descriptor.getCachePolicy().isSharedIsolation()) { getIdentityMapManager().putCacheKeyByIndex(index, indexValues, cacheKey, descriptor); } else { ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().putCacheKeyByIndex(index, indexValues, cacheKey, descriptor); } }
/** * Return the cache key for the cache index or null if not found. */ @Override public CacheKey getCacheKeyByIndex(CacheIndex index, CacheId indexValues, boolean shouldCheckExpiry, ClassDescriptor descriptor) { if (!descriptor.getCachePolicy().isSharedIsolation()) { return getIdentityMapManager().getCacheKeyByIndex(index, indexValues, shouldCheckExpiry, descriptor); } else { return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().getCacheKeyByIndex(index, indexValues, shouldCheckExpiry, descriptor); } }