Class UnitOfWorkIdentityMapAccessor
- java.lang.Object
-
- org.eclipse.persistence.internal.sessions.IdentityMapAccessor
-
- org.eclipse.persistence.internal.sessions.UnitOfWorkIdentityMapAccessor
-
- All Implemented Interfaces:
java.io.Serializable,IdentityMapAccessor
public class UnitOfWorkIdentityMapAccessor extends IdentityMapAccessor
INTERNAL: IdentityMapAccessor subclass for UnitOfWork Overrides some initialization functionality and some behavior having to do with getting objects from identity maps.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.eclipse.persistence.internal.sessions.IdentityMapAccessor
identityMapManager, session
-
-
Constructor Summary
Constructors Constructor Description UnitOfWorkIdentityMapAccessor()UnitOfWorkIdentityMapAccessor(AbstractSession session, IdentityMapManager identityMapManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.ObjectcheckForInheritance(java.lang.Object domainObject, java.lang.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.voidclearQueryCache()ADVANCED: Clear all the query cachesvoidclearQueryCache(java.lang.String sessionQueryName)ADVANCED: Clear the query cache associated with the named query on the sessionvoidclearQueryCache(java.lang.String descriptorQueryName, java.lang.Class queryClass)ADVANCED: Clear the query cache associated with the named query on the descriptor for the given classvoidclearQueryCache(ReadQuery query)ADVANCED: Clear the query class associated with the passed-in read querybooleancontainsObjectInIdentityMap(java.lang.Object primaryKey, java.lang.Class theClass, ClassDescriptor descriptor)INTERNAL: Return if their is an object for the primary key.java.util.VectorgetAllFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record translationRow, int valueHolderPolicy, boolean shouldReturnInvalidatedObjects)INTERNAL: This method overrides the getAllFromIdentityMap method in Session.protected java.lang.ObjectgetAndCloneCacheKeyFromParent(java.lang.Object primaryKey, java.lang.Object objectToClone, java.lang.Class theClass, boolean shouldReturnInvalidatedObjects, ClassDescriptor descriptor)INTERNAL: This method will return the object from the parent and clone it.java.lang.ObjectgetFromIdentityMap(java.lang.Object primaryKey, java.lang.Object object, java.lang.Class theClass, boolean shouldReturnInvalidatedObjects, ClassDescriptor descriptor)INTERNAL: Return the object from the identity map with the primary key and class.java.lang.ObjectgetFromIdentityMapWithDeferredLock(java.lang.Object primaryKey, java.lang.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 UnitOfWorkjava.lang.ObjectgetQueryResult(ReadQuery query, java.util.List parameters, boolean checkExpiry)INTERNAL: Get the cached results associated with a query.voidinitializeAllIdentityMaps()INTERNAL: Reset the entire object cache, ** be careful using this.voidinvalidateQueryCache(java.lang.Class classThatChanged)Invalidate/remove any results for the class from the query cache.voidputQueryResult(ReadQuery query, java.util.List parameters, java.lang.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, 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, getFromIdentityMap, getFromIdentityMap, getFromIdentityMapWithDeferredLock, getFromLocalIdentityMap, getFromLocalIdentityMapWithDeferredLock, getIdentityMap, getIdentityMap, getIdentityMap, getIdentityMapManager, getRemainingValidTime, getSession, getWrapper, getWriteLockManager, getWriteLockValue, getWriteLockValue, getWriteLockValue, getWriteLockValue, initializeIdentityMap, initializeIdentityMaps, internalPutInIdentityMap, invalidateAll, invalidateClass, invalidateClass, invalidateObject, invalidateObject, invalidateObject, invalidateObject, invalidateObject, invalidateObject, invalidateObject, invalidateObject, invalidateObjects, invalidateObjects, invalidateObjects, invalidateObjects, isValid, isValid, isValid, isValid, primaryKeyFromVector, printIdentityMap, printIdentityMapLocks, printIdentityMaps, putCacheKeyByIndex, putInIdentityMap, putInIdentityMap, putInIdentityMap, putInIdentityMap, putInIdentityMap, putInIdentityMap, putInIdentityMap, putInIdentityMap, releaseWriteLock, removeFromIdentityMap, removeFromIdentityMap, removeFromIdentityMap, removeFromIdentityMap, setIdentityMapManager, setWrapper, updateWriteLockValue, updateWriteLockValue, updateWriteLockValue, validateCache
-
-
-
-
Constructor Detail
-
UnitOfWorkIdentityMapAccessor
public UnitOfWorkIdentityMapAccessor()
-
UnitOfWorkIdentityMapAccessor
public UnitOfWorkIdentityMapAccessor(AbstractSession session, IdentityMapManager identityMapManager)
-
-
Method Detail
-
clearQueryCache
public void clearQueryCache()
ADVANCED: Clear all the query caches- Specified by:
clearQueryCachein interfaceIdentityMapAccessor- Overrides:
clearQueryCachein classIdentityMapAccessor
-
invalidateQueryCache
public void invalidateQueryCache(java.lang.Class classThatChanged)
Invalidate/remove any results for the class from the query cache. This is used to invalidate the query cache on any change.- Specified by:
invalidateQueryCachein interfaceIdentityMapAccessor- Overrides:
invalidateQueryCachein classIdentityMapAccessor
-
clearQueryCache
public void clearQueryCache(ReadQuery query)
ADVANCED: Clear the query class associated with the passed-in read query- Specified by:
clearQueryCachein interfaceIdentityMapAccessor- Overrides:
clearQueryCachein classIdentityMapAccessor
-
clearQueryCache
public void clearQueryCache(java.lang.String sessionQueryName)
ADVANCED: Clear the query cache associated with the named query on the session- Specified by:
clearQueryCachein interfaceIdentityMapAccessor- Overrides:
clearQueryCachein classIdentityMapAccessor
-
clearQueryCache
public void clearQueryCache(java.lang.String descriptorQueryName, java.lang.Class queryClass)ADVANCED: Clear the query cache associated with the named query on the descriptor for the given class- Specified by:
clearQueryCachein interfaceIdentityMapAccessor- Overrides:
clearQueryCachein classIdentityMapAccessor
-
containsObjectInIdentityMap
public boolean containsObjectInIdentityMap(java.lang.Object primaryKey, java.lang.Class theClass, ClassDescriptor descriptor)INTERNAL: Return if their is an object for the primary key.- Overrides:
containsObjectInIdentityMapin classIdentityMapAccessor
-
getAllFromIdentityMap
public java.util.Vector getAllFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record 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:
getAllFromIdentityMapin interfaceIdentityMapAccessor- Overrides:
getAllFromIdentityMapin classIdentityMapAccessor- Parameters:
selectionCriteria- Expression selecting the Objects to be returnedtheClass- Class to be consideredtranslationRow- RecordvalueHolderPolicy- seeInMemoryQueryIndirectionPolicyshouldReturnInvalidatedObjects- boolean - true if only invalid Objects should be returned- Returns:
- Vector of Objects
- Throws:
QueryException
-
getFromIdentityMapWithDeferredLock
public java.lang.Object getFromIdentityMapWithDeferredLock(java.lang.Object primaryKey, java.lang.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:
getFromIdentityMapWithDeferredLockin classIdentityMapAccessor
-
getFromIdentityMap
public java.lang.Object getFromIdentityMap(java.lang.Object primaryKey, java.lang.Object object, java.lang.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:
getFromIdentityMapin classIdentityMapAccessor
-
getAndCloneCacheKeyFromParent
protected java.lang.Object getAndCloneCacheKeyFromParent(java.lang.Object primaryKey, java.lang.Object objectToClone, java.lang.Class theClass, boolean shouldReturnInvalidatedObjects, ClassDescriptor descriptor)INTERNAL: This method will return the object from the parent and clone it.
-
getQueryResult
public java.lang.Object getQueryResult(ReadQuery query, java.util.List parameters, boolean checkExpiry)
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:
getQueryResultin classIdentityMapAccessor
-
putQueryResult
public void putQueryResult(ReadQuery query, java.util.List parameters, java.lang.Object results)
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:
putQueryResultin 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:
initializeAllIdentityMapsin interfaceIdentityMapAccessor- Overrides:
initializeAllIdentityMapsin classIdentityMapAccessor
-
checkForInheritance
protected java.lang.Object checkForInheritance(java.lang.Object domainObject, java.lang.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).
-
-