Module org.eclipse.persistence.core
Class UnitOfWorkIdentityMapAccessor
java.lang.Object
org.eclipse.persistence.internal.sessions.IdentityMapAccessor
org.eclipse.persistence.internal.sessions.UnitOfWorkIdentityMapAccessor
- All Implemented Interfaces:
Serializable
,IdentityMapAccessor
INTERNAL:
IdentityMapAccessor subclass for UnitOfWork
Overrides some initialization functionality and some behavior having to do with
getting objects from identity maps.
- See Also:
-
Field Summary
Fields inherited from class org.eclipse.persistence.internal.sessions.IdentityMapAccessor
identityMapManager, session
-
Constructor Summary
ConstructorsConstructorDescriptionUnitOfWorkIdentityMapAccessor
(AbstractSession session, IdentityMapManager identityMapManager) -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
checkForInheritance
(Object domainObject, Class<?> superClass, ClassDescriptor descriptor) This method is used to resolve the inheritance issues arise while trying to get object from identity map of parent session.void
ADVANCED: Clear all the query cachesvoid
clearQueryCache
(String sessionQueryName) ADVANCED: Clear the query cache associated with the named query on the sessionvoid
clearQueryCache
(String descriptorQueryName, Class<?> queryClass) ADVANCED: Clear the query cache associated with the named query on the descriptor for the given classvoid
clearQueryCache
(ReadQuery query) ADVANCED: Clear the query class associated with the passed-in read queryboolean
containsObjectInIdentityMap
(Object primaryKey, Class<?> theClass, ClassDescriptor descriptor) INTERNAL: Return if their is an object for the primary key.getAllFromIdentityMap
(Expression selectionCriteria, Class<?> theClass, DataRecord translationRow, int valueHolderPolicy, boolean shouldReturnInvalidatedObjects) INTERNAL: This method overrides the getAllFromIdentityMap method in Session.protected Object
getAndCloneCacheKeyFromParent
(Object primaryKey, Object objectToClone, Class<?> theClass, boolean shouldReturnInvalidatedObjects, ClassDescriptor descriptor) INTERNAL: This method will return the object from the parent and clone it.getFromIdentityMap
(Object primaryKey, Object object, Class<?> theClass, boolean shouldReturnInvalidatedObjects, ClassDescriptor descriptor) INTERNAL: Return the object from the identity map with the primary key and class.getFromIdentityMapWithDeferredLock
(Object primaryKey, Class<?> theClass, boolean shouldReturnInvalidatedObjects, ClassDescriptor descriptor) INTERNAL: Override the getFromIdentityMapWithDeferredLock method on the session to ensure that invalidated objects are always returned since this is a UnitOfWorkgetQueryResult
(ReadQuery query, List parameters, boolean checkExpiry) INTERNAL: Get the cached results associated with a query.void
INTERNAL: Reset the entire object cache, ** be careful using this.void
invalidateQueryCache
(Class<?> classThatChanged) Invalidate/remove any results for the class from the query cache.void
putQueryResult
(ReadQuery query, List parameters, Object results) INTERNAL: Set the results for a query.Methods inherited from class org.eclipse.persistence.internal.sessions.IdentityMapAccessor
acquireDeferredLock, acquireLock, acquireLock, acquireLockNoWait, acquireLockWithWait, acquireReadLockOnCacheKey, acquireReadLockOnCacheKeyNoWait, acquireWriteLock, containsObjectInIdentityMap, containsObjectInIdentityMap, containsObjectInIdentityMap, extractPrimaryKeyFromRow, getAllCacheKeysFromIdentityMapWithEntityPK, getAllFromIdentityMap, getAllFromIdentityMap, getAllFromIdentityMap, getAllFromIdentityMap, getAllFromIdentityMapWithEntityPK, getCacheKeyByIndex, getCacheKeyForObject, getCacheKeyForObject, getCacheKeyForObject, getCacheKeyForObjectForLock, getClassesRegistered, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMapWithDeferredLock, getFromLocalIdentityMap, getFromLocalIdentityMapWithDeferredLock, getIdentityMap, getIdentityMap, getIdentityMap, getIdentityMapManager, getRemainingValidTime, getSession, getWrapper, getWriteLockManager, getWriteLockValue, getWriteLockValue, getWriteLockValue, initializeIdentityMap, initializeIdentityMaps, internalPutInIdentityMap, invalidateAll, invalidateClass, invalidateClass, invalidateObject, invalidateObject, invalidateObject, invalidateObject, invalidateObject, invalidateObject, invalidateObjects, invalidateObjects, invalidateObjects, invalidateObjects, isValid, isValid, isValid, printIdentityMap, printIdentityMapLocks, printIdentityMaps, putCacheKeyByIndex, putInIdentityMap, putInIdentityMap, putInIdentityMap, putInIdentityMap, putInIdentityMap, releaseWriteLock, removeFromIdentityMap, removeFromIdentityMap, removeFromIdentityMap, setIdentityMapManager, setWrapper, updateWriteLockValue, updateWriteLockValue, validateCache
-
Constructor Details
-
UnitOfWorkIdentityMapAccessor
public UnitOfWorkIdentityMapAccessor() -
UnitOfWorkIdentityMapAccessor
public UnitOfWorkIdentityMapAccessor(AbstractSession session, IdentityMapManager identityMapManager)
-
-
Method Details
-
clearQueryCache
public void clearQueryCache()ADVANCED: Clear all the query caches- Specified by:
clearQueryCache
in interfaceIdentityMapAccessor
- Overrides:
clearQueryCache
in classIdentityMapAccessor
-
invalidateQueryCache
Invalidate/remove any results for the class from the query cache. This is used to invalidate the query cache on any change.- Specified by:
invalidateQueryCache
in interfaceIdentityMapAccessor
- Overrides:
invalidateQueryCache
in classIdentityMapAccessor
-
clearQueryCache
ADVANCED: Clear the query class associated with the passed-in read query- Specified by:
clearQueryCache
in interfaceIdentityMapAccessor
- Overrides:
clearQueryCache
in classIdentityMapAccessor
-
clearQueryCache
ADVANCED: Clear the query cache associated with the named query on the session- Specified by:
clearQueryCache
in interfaceIdentityMapAccessor
- Overrides:
clearQueryCache
in classIdentityMapAccessor
-
clearQueryCache
ADVANCED: Clear the query cache associated with the named query on the descriptor for the given class- Specified by:
clearQueryCache
in interfaceIdentityMapAccessor
- Overrides:
clearQueryCache
in classIdentityMapAccessor
-
containsObjectInIdentityMap
public boolean containsObjectInIdentityMap(Object primaryKey, Class<?> theClass, ClassDescriptor descriptor) INTERNAL: Return if their is an object for the primary key.- Overrides:
containsObjectInIdentityMap
in classIdentityMapAccessor
-
getAllFromIdentityMap
public Vector getAllFromIdentityMap(Expression selectionCriteria, Class<?> theClass, DataRecord translationRow, int valueHolderPolicy, boolean shouldReturnInvalidatedObjects) throws QueryException INTERNAL: This method overrides the getAllFromIdentityMap method in Session. Invalidated Objects will always be returned from a UnitOfWork.- Specified by:
getAllFromIdentityMap
in interfaceIdentityMapAccessor
- Overrides:
getAllFromIdentityMap
in classIdentityMapAccessor
- Parameters:
selectionCriteria
- Expression selecting the Objects to be returnedtheClass
- Class to be consideredtranslationRow
- RecordvalueHolderPolicy
- seeInMemoryQueryIndirectionPolicy
shouldReturnInvalidatedObjects
- boolean - true if only invalid Objects should be returned- Returns:
- Vector of Objects
- Throws:
QueryException
-
getFromIdentityMapWithDeferredLock
public Object getFromIdentityMapWithDeferredLock(Object primaryKey, Class<?> theClass, boolean shouldReturnInvalidatedObjects, ClassDescriptor descriptor) INTERNAL: Override the getFromIdentityMapWithDeferredLock method on the session to ensure that invalidated objects are always returned since this is a UnitOfWork- Overrides:
getFromIdentityMapWithDeferredLock
in classIdentityMapAccessor
-
getFromIdentityMap
public Object getFromIdentityMap(Object primaryKey, Object object, Class<?> theClass, boolean shouldReturnInvalidatedObjects, ClassDescriptor descriptor) INTERNAL: Return the object from the identity map with the primary key and class. The parent's cache must be checked after the child's, if found in the parent, it must be registered/cloned (but must avoid looping). Note: in a UnitOfWork, invalidated objects will always be returned from the identity map In the parent session, only return the object if it has not been Invalidated- Overrides:
getFromIdentityMap
in classIdentityMapAccessor
-
getAndCloneCacheKeyFromParent
protected Object getAndCloneCacheKeyFromParent(Object primaryKey, Object objectToClone, Class<?> theClass, boolean shouldReturnInvalidatedObjects, ClassDescriptor descriptor) INTERNAL: This method will return the object from the parent and clone it. -
getQueryResult
INTERNAL: Get the cached results associated with a query. Results are cached by the values of the parameters to the query so different parameters will have different cached results. results are only cached in the parent session for UnitOfWorks- Overrides:
getQueryResult
in classIdentityMapAccessor
-
putQueryResult
INTERNAL: Set the results for a query. Query results are cached based on the parameter values provided to the query different parameter values access different caches. Results are only cached in the parent session for UnitOfWorks- Overrides:
putQueryResult
in classIdentityMapAccessor
-
initializeAllIdentityMaps
public void initializeAllIdentityMaps()INTERNAL: Reset the entire object cache, ** be careful using this. This method blows away both this session's and its parents caches, this includes the server cache or any other cache. This throws away any objects that have been read in. Extreme caution should be used before doing this because object identity will no longer be maintained for any objects currently read in. This should only be called if the application knows that it no longer has references to object held in the cache.- Specified by:
initializeAllIdentityMaps
in interfaceIdentityMapAccessor
- Overrides:
initializeAllIdentityMaps
in classIdentityMapAccessor
-
checkForInheritance
protected Object checkForInheritance(Object domainObject, Class<?> superClass, ClassDescriptor descriptor) This method is used to resolve the inheritance issues arise while trying to get object from identity map of parent session. Avoid reading the unintended subclass during in-memory query (e.g. when querying on large project, do not want to check small project, both are inherited from the project, and stored in the same identity map).
-