Oracle TopLink API Reference
10g Release 3 (10.1.3)

B13698-01

oracle.toplink.sessions
Interface IdentityMapAccessor


public interface IdentityMapAccessor

PUBLIC: IdentityMapAccessor provides the public interface into all functionality associated with TopLink identity maps. As appropriate IdentityMapAccessor can be obtained from a session with it's getIdentityMapAccessor() method. Methods that used to be called on the Session to access identity maps can now be called through the IdentityMapAccessor. For instance, to initialize identity maps the code used to be: session.initializeIdentityIdentityMaps() The code now is: session.getIdentityMapAccessor().initializeIdentityMaps()

See Also:
Session

Method Summary
 void clearQueryCache()
          ADVANCED: Clear all the query caches
 void clearQueryCache(ReadQuery query)
          ADVANCED: Clear the query class associated with the passed-in read query
 void clearQueryCache(java.lang.String sessionQueryName)
          ADVANCED: Clear the query cache associated with the named query on the session
 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
 boolean containsObjectInIdentityMap(java.lang.Object domainObject)
          ADVANCED: Return if there is an object for the primary key.
 boolean containsObjectInIdentityMap(Record rowContainingPrimaryKey, java.lang.Class theClass)
          ADVANCED: Return if there is an object for the row containing primary key and the class.
 boolean containsObjectInIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass)
          ADVANCED: Return if there is an object for the primary key.
 java.util.Vector getAllFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record translationRow, InMemoryQueryIndirectionPolicy valueHolderPolicy)
          ADVANCED: Query the cache in-memory.
 java.util.Vector getAllFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record translationRow, InMemoryQueryIndirectionPolicy valueHolderPolicy, boolean shouldReturnInvalidatedObjects)
          ADVANCED: Query the cache in-memory.
 java.lang.Object getFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record translationRow)
          ADVANCED: Query the cache in-memory.
 java.lang.Object getFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record translationRow, InMemoryQueryIndirectionPolicy valueHolderPolicy)
          ADVANCED: Query the cache in-memory.
 java.lang.Object getFromIdentityMap(java.lang.Object domainObject)
          ADVANCED: Return the object from the identity with primary and class of the given object.
 java.lang.Object getFromIdentityMap(Record rowContainingPrimaryKey, java.lang.Class theClass)
          ADVANCED: Return the object from the identity with the primary and class.
 java.lang.Object getFromIdentityMap(Record rowContainingPrimaryKey, java.lang.Class theClass, boolean shouldReturnInvalidatedObjects)
          ADVANCED: Return the object from the identity with the primary and class.
 java.lang.Object getFromIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass)
          ADVANCED: Return the object from the identity with the primary and class.
 java.lang.Object getFromIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass, boolean shouldReturnInvalidatedObjects)
          ADVANCED: Return the object from the identity with the primary and class.
 long getRemainingValidTime(java.lang.Object object)
          ADVANCED: Return the remaining life of this object.
 java.lang.Object getWriteLockValue(java.lang.Object domainObject)
          ADVANCED: Extract the write lock value from the identity map.
 java.lang.Object getWriteLockValue(java.util.Vector primaryKey, java.lang.Class theClass)
          ADVANCED: Extract the write lock value from the identity map.
 void initializeAllIdentityMaps()
          PUBLIC: Reset the entire object cache.
 void initializeIdentityMap(java.lang.Class theClass)
          PUBLIC: Reset the identity map for only the instances of the class.
 void initializeIdentityMaps()
          PUBLIC: Reset the entire local object cache.
 void invalidateAll()
          ADVANCED: Set all of the objects for all classes to be invalid in TopLink's identity maps.
 void invalidateClass(java.lang.Class myClass)
          ADVANCED: Set all of the objects of a specific class to be invalid in TopLink's identity maps Will set the recurse on inheritance to true.
 void invalidateClass(java.lang.Class myClass, boolean recurse)
          ADVANCED: Set all of the objects of a specific class to be invalid in TopLink's identity maps.
 void invalidateObject(java.lang.Object object)
          ADVANCED: Set an object to be invalid in the TopLink identity maps.
 void invalidateObject(Record rowContainingPrimaryKey, java.lang.Class theClass)
          ADVANCED: Set an object to be invalid in the TopLink identity maps.
 void invalidateObject(java.util.Vector primaryKey, java.lang.Class theClass)
          ADVANCED: Set an object to be invalid in the TopLink identity maps.
 void invalidateObjects(Expression selectionCriteria)
          ADVANCED: Set all of the objects from the given Expression to be invalid in the TopLink Identity Maps
 void invalidateObjects(java.util.Vector collection)
          ADVANCED: Set all of the objects in the given collection to be invalid in the TopLink Identity Maps This method will take no action for any objects in the collection that do not exist in the cache.
 boolean isValid(DatabaseRow rowContainingPrimaryKey, java.lang.Class theClass)
          ADVANCED: Return true if this object is valid in TopLink's identity maps return false otherwise
 boolean isValid(java.lang.Object object)
          ADVANCED: Return true if this object is valid in TopLink's identity maps return false otherwise
 boolean isValid(java.util.Vector primaryKey, java.lang.Class theClass)
          ADVANCED: Return true if this object is valid in TopLink's identity maps return false otherwise
 void printIdentityMap(java.lang.Class businessClass)
          PUBLIC: Used to print all the objects in the identity map of the passed in class.
 void printIdentityMapLocks()
          PUBLIC: Used to print all the locks in every identity map in this session.
 void printIdentityMaps()
          PUBLIC: Used to print all the objects in every identity map in this session.
 java.lang.Object putInIdentityMap(java.lang.Object domainObject)
          ADVANCED: Register the object with the identity map.
 java.lang.Object putInIdentityMap(java.lang.Object domainObject, java.util.Vector key)
          ADVANCED: Register the object with the identity map.
 java.lang.Object putInIdentityMap(java.lang.Object domainObject, java.util.Vector key, java.lang.Object writeLockValue)
          ADVANCED: Register the object with the identity map.
 java.lang.Object putInIdentityMap(java.lang.Object domainObject, java.util.Vector key, java.lang.Object writeLockValue, long readTime)
          ADVANCED: Register the object with the identity map.
 java.lang.Object removeFromIdentityMap(java.lang.Object domainObject)
          ADVANCED: Remove the object from the object cache.
 java.lang.Object removeFromIdentityMap(java.util.Vector key, java.lang.Class theClass)
          ADVANCED: Remove the object from the object cache.
 void updateWriteLockValue(java.lang.Object domainObject, java.lang.Object writeLockValue)
          ADVANCED: Update the write lock value in the identity map.
 void updateWriteLockValue(java.util.Vector primaryKey, java.lang.Class theClass, java.lang.Object writeLockValue)
          ADVANCED: Update the write lock value in the identity map.
 void validateCache()
          ADVANCED: This can be used to help debugging an object identity problem.
 

Method Detail

clearQueryCache

public void clearQueryCache()
ADVANCED: Clear all the query caches


clearQueryCache

public void clearQueryCache(ReadQuery query)
ADVANCED: Clear the query class associated with the passed-in read query


clearQueryCache

public void clearQueryCache(java.lang.String sessionQueryName)
ADVANCED: Clear the query cache associated with the named query on the session


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


containsObjectInIdentityMap

public boolean containsObjectInIdentityMap(java.lang.Object domainObject)
ADVANCED: Return if there is an object for the primary key.


containsObjectInIdentityMap

public boolean containsObjectInIdentityMap(java.util.Vector primaryKey,
                                           java.lang.Class theClass)
ADVANCED: Return if there is an object for the primary key.


containsObjectInIdentityMap

public boolean containsObjectInIdentityMap(Record rowContainingPrimaryKey,
                                           java.lang.Class theClass)
ADVANCED: Return if there is an object for the row containing primary key and the class.


getAllFromIdentityMap

public java.util.Vector getAllFromIdentityMap(Expression selectionCriteria,
                                              java.lang.Class theClass,
                                              Record translationRow,
                                              InMemoryQueryIndirectionPolicy valueHolderPolicy,
                                              boolean shouldReturnInvalidatedObjects)
                                       throws QueryException
ADVANCED: Query the cache in-memory. If the expression is too complex an exception will be thrown. Only return objects that are invalid in the cache if specified.

Throws:
QueryException

getAllFromIdentityMap

public java.util.Vector getAllFromIdentityMap(Expression selectionCriteria,
                                              java.lang.Class theClass,
                                              Record translationRow,
                                              InMemoryQueryIndirectionPolicy valueHolderPolicy)
                                       throws QueryException
ADVANCED: Query the cache in-memory. If the expression is too complex an exception will be thrown.

Throws:
QueryException

getFromIdentityMap

public java.lang.Object getFromIdentityMap(java.lang.Object domainObject)
ADVANCED: Return the object from the identity with primary and class of the given object.


getFromIdentityMap

public java.lang.Object getFromIdentityMap(java.util.Vector primaryKey,
                                           java.lang.Class theClass)
ADVANCED: Return the object from the identity with the primary and class.


getFromIdentityMap

public java.lang.Object getFromIdentityMap(Record rowContainingPrimaryKey,
                                           java.lang.Class theClass)
ADVANCED: Return the object from the identity with the primary and class.


getFromIdentityMap

public java.lang.Object getFromIdentityMap(java.util.Vector primaryKey,
                                           java.lang.Class theClass,
                                           boolean shouldReturnInvalidatedObjects)
ADVANCED: Return the object from the identity with the primary and class. Only return invalidated objects if requested.


getFromIdentityMap

public java.lang.Object getFromIdentityMap(Record rowContainingPrimaryKey,
                                           java.lang.Class theClass,
                                           boolean shouldReturnInvalidatedObjects)
ADVANCED: Return the object from the identity with the primary and class. Only return invalidated objects if requested.


getFromIdentityMap

public java.lang.Object getFromIdentityMap(Expression selectionCriteria,
                                           java.lang.Class theClass,
                                           Record translationRow)
                                    throws QueryException
ADVANCED: Query the cache in-memory. If the object is not found null is returned. If the expression is too complex an exception will be thrown.

Throws:
QueryException

getFromIdentityMap

public java.lang.Object getFromIdentityMap(Expression selectionCriteria,
                                           java.lang.Class theClass,
                                           Record translationRow,
                                           InMemoryQueryIndirectionPolicy valueHolderPolicy)
                                    throws QueryException
ADVANCED: Query the cache in-memory. If the object is not found null is returned. If the expression is too complex an exception will be thrown.

Throws:
QueryException

getRemainingValidTime

public long getRemainingValidTime(java.lang.Object object)
ADVANCED: Return the remaining life of this object. This method is associated with use of TopLink's cache invalidation feature and returns the difference between the next expiry time of the object and its read time. The method will return 0 for invalidated objects.


getWriteLockValue

public java.lang.Object getWriteLockValue(java.lang.Object domainObject)
ADVANCED: Extract the write lock value from the identity map.


getWriteLockValue

public java.lang.Object getWriteLockValue(java.util.Vector primaryKey,
                                          java.lang.Class theClass)
ADVANCED: Extract the write lock value from the identity map.


initializeAllIdentityMaps

public void initializeAllIdentityMaps()
PUBLIC: Reset the entire object cache.

NOTE: be careful using this method. 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. Extream 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.


initializeIdentityMap

public void initializeIdentityMap(java.lang.Class theClass)
PUBLIC: Reset the identity map for only the instances of the class. For inheritance the user must make sure that they only use the root class. Caution must be used in doing this to ensure that the objects within the identity map are not referenced from other objects of other classes or from the application.


initializeIdentityMaps

public void initializeIdentityMaps()
PUBLIC: Reset the entire local object cache. This throws away any objects that have been read in. Extream 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.


invalidateObject

public void invalidateObject(java.lang.Object object)
ADVANCED: Set an object to be invalid in the TopLink identity maps. If the object does not exist in the cache, this method will return without any action


invalidateObject

public void invalidateObject(java.util.Vector primaryKey,
                             java.lang.Class theClass)
ADVANCED: Set an object to be invalid in the TopLink identity maps. If the object does not exist in the cache, this method will return without any action


invalidateObject

public void invalidateObject(Record rowContainingPrimaryKey,
                             java.lang.Class theClass)
ADVANCED: Set an object to be invalid in the TopLink identity maps. If the object does not exist in the cache, this method will return without any action


invalidateObjects

public void invalidateObjects(java.util.Vector collection)
ADVANCED: Set all of the objects in the given collection to be invalid in the TopLink Identity Maps This method will take no action for any objects in the collection that do not exist in the cache.


invalidateObjects

public void invalidateObjects(Expression selectionCriteria)
ADVANCED: Set all of the objects from the given Expression to be invalid in the TopLink Identity Maps


invalidateAll

public void invalidateAll()
ADVANCED: Set all of the objects for all classes to be invalid in TopLink's identity maps. It will recurse on inheritance.


invalidateClass

public void invalidateClass(java.lang.Class myClass)
ADVANCED: Set all of the objects of a specific class to be invalid in TopLink's identity maps Will set the recurse on inheritance to true.


invalidateClass

public void invalidateClass(java.lang.Class myClass,
                            boolean recurse)
ADVANCED: Set all of the objects of a specific class to be invalid in TopLink's identity maps. User can set the recurse flag to false if they do not want to invalidate all the classes within an inheritance tree.


isValid

public boolean isValid(java.lang.Object object)
ADVANCED: Return true if this object is valid in TopLink's identity maps return false otherwise


isValid

public boolean isValid(java.util.Vector primaryKey,
                       java.lang.Class theClass)
ADVANCED: Return true if this object is valid in TopLink's identity maps return false otherwise


isValid

public boolean isValid(DatabaseRow rowContainingPrimaryKey,
                       java.lang.Class theClass)
ADVANCED: Return true if this object is valid in TopLink's identity maps return false otherwise


printIdentityMap

public void printIdentityMap(java.lang.Class businessClass)
PUBLIC: Used to print all the objects in the identity map of the passed in class. The output of this method will be logged to this session's SessionLog at SEVERE level.


printIdentityMaps

public void printIdentityMaps()
PUBLIC: Used to print all the objects in every identity map in this session. The output of this method will be logged to this session's SessionLog at SEVERE level.


printIdentityMapLocks

public void printIdentityMapLocks()
PUBLIC: Used to print all the locks in every identity map in this session. The output of this method will be logged to this session's SessionLog at FINEST level.


putInIdentityMap

public java.lang.Object putInIdentityMap(java.lang.Object domainObject)
ADVANCED: Register the object with the identity map. The object must always be registered with its version number if optimistic locking is used.


putInIdentityMap

public java.lang.Object putInIdentityMap(java.lang.Object domainObject,
                                         java.util.Vector key)
ADVANCED: Register the object with the identity map. The object must always be registered with its version number if optimistic locking is used.


putInIdentityMap

public java.lang.Object putInIdentityMap(java.lang.Object domainObject,
                                         java.util.Vector key,
                                         java.lang.Object writeLockValue)
ADVANCED: Register the object with the identity map. The object must always be registered with its version number if optimistic locking is used.


putInIdentityMap

public java.lang.Object putInIdentityMap(java.lang.Object domainObject,
                                         java.util.Vector key,
                                         java.lang.Object writeLockValue,
                                         long readTime)
ADVANCED: Register the object with the identity map. The object must always be registered with its version number if optimistic locking is used. The readTime may also be included in the cache key as it is constructed


removeFromIdentityMap

public java.lang.Object removeFromIdentityMap(java.lang.Object domainObject)
ADVANCED: Remove the object from the object cache. Caution should be used when calling to avoid violating object identity. The application should only call this is it knows that no references to the object exist.


removeFromIdentityMap

public java.lang.Object removeFromIdentityMap(java.util.Vector key,
                                              java.lang.Class theClass)
ADVANCED: Remove the object from the object cache.


updateWriteLockValue

public void updateWriteLockValue(java.lang.Object domainObject,
                                 java.lang.Object writeLockValue)
ADVANCED: Update the write lock value in the identity map.


updateWriteLockValue

public void updateWriteLockValue(java.util.Vector primaryKey,
                                 java.lang.Class theClass,
                                 java.lang.Object writeLockValue)
ADVANCED: Update the write lock value in the identity map.


validateCache

public void validateCache()
ADVANCED: This can be used to help debugging an object identity problem. An object identity problem is when an object in the cache references an object not in the cache. This method will validate that all cached objects are in a correct state.


Copyright © 1998, 2006, Oracle. All Rights Reserved.