|
Oracle TopLink Java API Reference 10g Release 3 (10.1.3.1) B28219-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
PUBLIC: IdentityMapAccessor provides the public interface into all functionality associated with TopLink identity maps. An appropriate IdentityMapAccessor can be obtained from a session with its 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()
With this class, the code now is: session.getIdentityMapAccessor().initializeIdentityMaps()
Session
Method Summary | |
void |
clearQueryCache() ADVANCED: Clears all the query caches. |
void |
clearQueryCache(ReadQuery query) ADVANCED: Clears the query cache of the results associated with the given read query. |
void |
clearQueryCache(java.lang.String sessionQueryName) ADVANCED: Clears the query cache of the results associated with the given session query name. |
void |
clearQueryCache(java.lang.String descriptorQueryName, java.lang.Class queryClass) ADVANCED: Clears the query cache associated with the given descriptor query name and Class type. |
boolean |
containsObjectInIdentityMap(java.lang.Object domainObject) ADVANCED: Returns true if the identity map contains an Object with the same primary key and Class type of the given domainObject. |
boolean |
containsObjectInIdentityMap(Record rowContainingPrimaryKey, java.lang.Class theClass) ADVANCED: Returns true if the identity map contains an Object with the same primary key of the specified row (ie. the database record) and Class type. |
boolean |
containsObjectInIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass) ADVANCED: Returns true if the identity map contains an Object with the same primary key and Class type as those specified. |
java.util.Vector |
getAllFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record translationRow, InMemoryQueryIndirectionPolicy valueHolderPolicy) ADVANCED: Queries the cache in-memory with the passed in criteria and returns matching Objects. |
java.util.Vector |
getAllFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record translationRow, InMemoryQueryIndirectionPolicy valueHolderPolicy, boolean shouldReturnInvalidatedObjects) ADVANCED: Queries the cache in-memory with the passed in criteria and returns matching Objects. |
java.lang.Object |
getFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record translationRow) ADVANCED: Queries the cache in-memory and returns an Object from this identity map. |
java.lang.Object |
getFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record translationRow, InMemoryQueryIndirectionPolicy valueHolderPolicy) ADVANCED: Queries the cache in-memory and returns an Object from this identity map. |
java.lang.Object |
getFromIdentityMap(java.lang.Object domainObject) ADVANCED: Returns the Object from the identity map with the same primary key and Class type of the given domainObject. |
java.lang.Object |
getFromIdentityMap(Record rowContainingPrimaryKey, java.lang.Class theClass) ADVANCED: Returns the Object from the identity map with the same primary key of the specified row (ie. the database record) and Class type. |
java.lang.Object |
getFromIdentityMap(Record rowContainingPrimaryKey, java.lang.Class theClass, boolean shouldReturnInvalidatedObjects) ADVANCED: Returns the Object from the identity map with the same primary key of the specified row and Class type. |
java.lang.Object |
getFromIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass) ADVANCED: Returns the Object from the identity map with the same primary key and Class type as those specified. |
java.lang.Object |
getFromIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass, boolean shouldReturnInvalidatedObjects) ADVANCED: Returns the Object from the identity map with the same primary key and Class type as specified. |
long |
getRemainingValidTime(java.lang.Object object) ADVANCED: Returns the remaining life of the given Object. |
java.lang.Object |
getWriteLockValue(java.lang.Object domainObject) ADVANCED: Extracts and returns the write lock value from the identity map through the given Object. |
java.lang.Object |
getWriteLockValue(java.util.Vector primaryKey, java.lang.Class theClass) ADVANCED: Extracts the write lock value from the identity map through the passed in primaryKey and Class type. |
void |
initializeAllIdentityMaps() PUBLIC: Resets the entire Object cache. |
void |
initializeIdentityMap(java.lang.Class theClass) PUBLIC: Resets the identity map for only the instances of the given Class type. |
void |
initializeIdentityMaps() PUBLIC: Resets the entire local Object cache. |
void |
invalidateAll() ADVANCED: Sets all of the Objects for all classes to be invalid in TopLink's identity maps. |
void |
invalidateClass(java.lang.Class myClass) ADVANCED: Sets all of the Objects of the specified Class type 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: Sets all of the Objects of the specified Class type to be invalid in TopLink's identity maps. |
void |
invalidateObject(java.lang.Object object) ADVANCED: Sets an Object to be invalid in the TopLink identity maps. |
void |
invalidateObject(Record rowContainingPrimaryKey, java.lang.Class theClass) ADVANCED: Sets an Object with the specified primary key of the passed in Row and Class type to be invalid in the TopLink identity maps. |
void |
invalidateObject(java.util.Vector primaryKey, java.lang.Class theClass) ADVANCED: Sets an Object with the specified primary key and Class type to be invalid in the TopLink identity maps. |
void |
invalidateObjects(Expression selectionCriteria) ADVANCED: Sets all of the Objects matching the given Expression to be invalid in the TopLink identity maps. |
void |
invalidateObjects(java.util.Vector collection) ADVANCED: Sets all of the Objects in the given collection to be invalid in the TopLink identity maps. |
boolean |
isValid(DatabaseRow rowContainingPrimaryKey, java.lang.Class theClass) ADVANCED: Returns true if this Object with the given primary key of the Row and Class type given is valid in TopLink's identity maps. |
boolean |
isValid(java.lang.Object object) ADVANCED: Returns true if an Object with the same primary key and Class type of the the given Object is valid in TopLink's identity maps. |
boolean |
isValid(java.util.Vector primaryKey, java.lang.Class theClass) ADVANCED: Returns true if the Object described by the given primary key and Class type is valid in TopLink's identity maps. |
void |
printIdentityMap(java.lang.Class businessClass) PUBLIC: Used to print all the Objects in the identity map of the given Class type. |
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: Registers the given Object with the identity map. |
java.lang.Object |
putInIdentityMap(java.lang.Object domainObject, java.util.Vector key) ADVANCED: Registers the Object and given key with the identity map. |
java.lang.Object |
putInIdentityMap(java.lang.Object domainObject, java.util.Vector key, java.lang.Object writeLockValue) ADVANCED: Registers the Object and given key with the identity map. |
java.lang.Object |
putInIdentityMap(java.lang.Object domainObject, java.util.Vector key, java.lang.Object writeLockValue, long readTime) ADVANCED: Registers the given Object with the identity map. |
java.lang.Object |
removeFromIdentityMap(java.lang.Object domainObject) ADVANCED: Removes the Object from the Object cache. |
java.lang.Object |
removeFromIdentityMap(java.util.Vector key, java.lang.Class theClass) ADVANCED: Removes the Object with given primary key and Class from the Object cache. |
void |
updateWriteLockValue(java.lang.Object domainObject, java.lang.Object writeLockValue) ADVANCED: Updates the write lock value in the identity map for cache key of the primary key the given Object. |
void |
updateWriteLockValue(java.util.Vector primaryKey, java.lang.Class theClass, java.lang.Object writeLockValue) ADVANCED: Updates the write lock value in the cache for the Object with same primary key as the given Object. |
void |
validateCache() ADVANCED: This can be used to help debugging an Object identity problem. |
Method Detail |
public void clearQueryCache()
public void clearQueryCache(ReadQuery query)
query
- ReadQuerypublic void clearQueryCache(java.lang.String sessionQueryName)
sessionQueryName
- Stringpublic void clearQueryCache(java.lang.String descriptorQueryName, java.lang.Class queryClass)
descriptorQueryName
- StringqueryClass
- Classpublic boolean containsObjectInIdentityMap(java.lang.Object domainObject)
domainObject
- Objectpublic boolean containsObjectInIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass)
primaryKey
- VectortheClass
- Classpublic boolean containsObjectInIdentityMap(Record rowContainingPrimaryKey, java.lang.Class theClass)
rowContainingPrimaryKey
- RecordtheClass
- Class type to be foundpublic java.util.Vector getAllFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record translationRow, InMemoryQueryIndirectionPolicy valueHolderPolicy, boolean shouldReturnInvalidatedObjects) throws QueryException
selectionCriteria
- Expression selecting the Objects to be returnedtheClass
- Class to be consideredtranslationRow
- RecordvalueHolderPolicy
- see InMemoryQueryIndirectionPolicy
shouldReturnInvalidatedObjects
- boolean - true if only invalid Objects should be returnedQueryException
public java.util.Vector getAllFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record translationRow, InMemoryQueryIndirectionPolicy valueHolderPolicy) throws QueryException
selectionCriteria
- Expression selecting the Objects to be returnedtheClass
- Class to be consideredtranslationRow
- RecordvalueHolderPolicy
- see InMemoryQueryIndirectionPolicy
QueryException
public java.lang.Object getFromIdentityMap(java.lang.Object domainObject)
domainObject
- Objectpublic java.lang.Object getFromIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass)
primaryKey
- VectortheClass
- Classpublic java.lang.Object getFromIdentityMap(Record rowContainingPrimaryKey, java.lang.Class theClass)
rowContainingPrimaryKey
- RecordtheClass
- Classpublic java.lang.Object getFromIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass, boolean shouldReturnInvalidatedObjects)
primaryKey
- VectortheClass
- ClassshouldReturnInvalidatedObjects
- InMemoryQueryIndirectionPolicypublic java.lang.Object getFromIdentityMap(Record rowContainingPrimaryKey, java.lang.Class theClass, boolean shouldReturnInvalidatedObjects)
rowContainingPrimaryKey
- RecordtheClass
- ClassshouldReturnInvalidatedObjects
- booleanpublic java.lang.Object getFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record translationRow) throws QueryException
selectionCriteria
- ExpressiontheClass
- ClasstranslationRow
- RecordQueryException
public java.lang.Object getFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record translationRow, InMemoryQueryIndirectionPolicy valueHolderPolicy) throws QueryException
selectionCriteria
- ExpressiontheClass
- ClasstranslationRow
- RecordvalueHolderPolicy
- see InMemoryQueryIndirectionPolicy
QueryException
public long getRemainingValidTime(java.lang.Object object)
object
- Object under considerationpublic java.lang.Object getWriteLockValue(java.lang.Object domainObject)
domainObject
- Objectpublic java.lang.Object getWriteLockValue(java.util.Vector primaryKey, java.lang.Class theClass)
primaryKey
- VectortheClass
- Classpublic void initializeAllIdentityMaps()
NOTE: Be careful using this method. This method blows away both this session's and its parent's 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 Objects held in the cache.
public void initializeIdentityMap(java.lang.Class theClass)
NOTE: 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.
theClass
- Classpublic void initializeIdentityMaps()
NOTE: 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 Objects held in the cache.
public void invalidateObject(java.lang.Object object)
object
- Objectpublic void invalidateObject(java.util.Vector primaryKey, java.lang.Class theClass)
primaryKey
- VectortheClass
- Classpublic void invalidateObject(Record rowContainingPrimaryKey, java.lang.Class theClass)
rowContainingPrimaryKey
- RecordtheClass
- Classpublic void invalidateObjects(java.util.Vector collection)
collection
- Vector of Objects to be invalidatedpublic void invalidateObjects(Expression selectionCriteria)
Example - Invalidating Employee Objects with non-null first names:
ExpressionBuilder eb = new ExpressionBuilder(Employee.class);
Expression exp = eb.get("firstName").notNull();
session.getIdentityMapAccessor().invalidateObjects(exp);
selectionCriteria
- Expressionpublic void invalidateAll()
public void invalidateClass(java.lang.Class myClass)
myClass
- Classpublic void invalidateClass(java.lang.Class myClass, boolean recurse)
myClass
- Classrecurse
- booleanpublic boolean isValid(java.lang.Object object)
object
- Objectpublic boolean isValid(java.util.Vector primaryKey, java.lang.Class theClass)
primaryKey
- VectortheClass
- Classpublic boolean isValid(DatabaseRow rowContainingPrimaryKey, java.lang.Class theClass)
rowContainingPrimaryKey
- DatabaseRow, now deprecated, replaced by DatabaseRecord
and Record
Database
as a replacement in this instance.theClass
- Classpublic void printIdentityMap(java.lang.Class businessClass)
businessClass
- Classpublic void printIdentityMaps()
public void printIdentityMapLocks()
public java.lang.Object putInIdentityMap(java.lang.Object domainObject)
domainObject
- Objectpublic java.lang.Object putInIdentityMap(java.lang.Object domainObject, java.util.Vector key)
domainObject
- Objectkey
- Vectorpublic java.lang.Object putInIdentityMap(java.lang.Object domainObject, java.util.Vector key, java.lang.Object writeLockValue)
domainObject
- Objectkey
- VectorwriteLockValue
- Object for versioningpublic java.lang.Object putInIdentityMap(java.lang.Object domainObject, java.util.Vector key, java.lang.Object writeLockValue, long readTime)
domainObject
- Objectkey
- VectorwriteLockValue
- Object for versioningreadTime
- long, time in millisecondspublic java.lang.Object removeFromIdentityMap(java.lang.Object domainObject)
NOTE: Caution should be used when calling to avoid violating Object identity. The application should only call this if its known that no references to the Object exist.
domainObject
- Objectpublic java.lang.Object removeFromIdentityMap(java.util.Vector key, java.lang.Class theClass)
NOTE: Caution should be used when calling to avoid violating Object identity. The application should only call this if its known that no references to the Object exist.
key
- VectortheClass
- Classpublic void updateWriteLockValue(java.lang.Object domainObject, java.lang.Object writeLockValue)
domainObject
- ObjectwriteLockValue
- Object for versioningpublic void updateWriteLockValue(java.util.Vector primaryKey, java.lang.Class theClass, java.lang.Object writeLockValue)
primaryKey
- VectortheClass
- ClasswriteLockValue
- Object for versioningpublic void validateCache()
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |