|
Oracle Application Server TopLink API Reference 10g (9.0.4.3) B10491-02 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
oracle.toplink.queryframework.DatabaseQuery
oracle.toplink.queryframework.ReadQuery
oracle.toplink.queryframework.ObjectLevelReadQuery
Purpose: Abstract class for all read queries using objects.
Description: Contains common behavior for all read queries using objects.
| Field Summary | |
static int |
CheckCacheByExactPrimaryKey |
static int |
CheckCacheByPrimaryKey |
static int |
CheckCacheOnly |
static int |
CheckCacheThenDatabase |
static int |
ConformResultsInUnitOfWork |
static int |
DoNotCheckCache |
static short |
DONT_USE_DISTINCT |
InMemoryQueryIndirectionPolicy |
inMemoryQueryIndirectionPolicyUsed to determine behaviour of indirection in InMemoryQuerying |
static short |
LOCK |
static short |
LOCK_NOWAIT |
static short |
NO_LOCK |
static short |
UNCOMPUTED_DISTINCT |
static short |
USE_DISTINCT |
| Fields inherited from class oracle.toplink.queryframework.DatabaseQuery |
CascadeAggregateDelete, CascadeAllParts, CascadeDependentParts, CascadePrivateParts, NoCascading, QUERY_PREPARE |
| Fields inherited from interface oracle.toplink.internal.helper.FalseUndefinedTrue |
False, True, Undefined |
| Constructor Summary | |
ObjectLevelReadQuery()INTERNAL: Initialize the state of the query | |
| Method Summary | |
void |
acquireLocks()PUBLIC: Set the query to lock, this will also turn refreshCache on. |
void |
acquireLocksWithoutWaiting()PUBLIC: Set the query to lock without waiting (blocking), this will also turn refreshCache on. |
void |
addAdditionalField(oracle.toplink.internal.helper.DatabaseField field)INTERNAL: Additional fields can be added to a query. |
void |
addAdditionalField(Expression fieldExpression)INTERNAL: Additional fields can be added to a query. |
void |
addJoinedAttribute(Expression attributeExpression)PUBLIC: Specify the one-to-one mapped attribute to be optimized in this query. |
void |
addJoinedAttribute(java.lang.String attributeName)PUBLIC: Specify the one-to-one mapped attribute to be optimized in this query. |
void |
addPartialAttribute(Expression attributeExpression)PUBLIC: Specify that only a subset of the class' attributes be selected in this query. |
void |
addPartialAttribute(java.lang.String attributeName)PUBLIC: Specify that only a subset of the class' attributes be selected in this query. |
java.lang.Object |
buildObject(DatabaseRow row)INTERNAL: Called by CursoredStream to construct objects from rows. |
void |
changeDescriptor(oracle.toplink.publicinterface.Session theSession)INTERNAL: The reference class has been changed, need to reset the descriptor. |
void |
checkCacheOnly()PUBLIC: The cache will checked completely, if the object is not found null will be returned or an error if the query is too complex. |
void |
checkDescriptor(oracle.toplink.publicinterface.Session session)INTERNAL: Ensure that the descriptor has been set. |
void |
conformResultsInUnitOfWork()PUBLIC: The cache will checked completely, if the object is not found the database will be queried, and the database result will be verified with what is in the cache and/or unit of work including new objects. |
void |
dontAcquireLocks()PUBLIC: Set the query not to lock. |
void |
dontCheckCache()PUBLIC: This can be used to explicitly disable the cache hit. |
void |
dontRefreshIdentityMapResult()PUBLIC: When unset means perform read normally and dont do refresh. |
void |
dontRefreshRemoteIdentityMapResult()PUBLIC: When unset means perform read normally and dont do refresh. |
void |
dontUseDistinct()ADVANCED: If a distinct has been set the DISTINCT clause will be printed. |
java.util.Vector |
getAdditionalFields()INTERNAL: Additional fields can be added to a query. |
oracle.toplink.internal.expressions.QueryKeyExpression |
getBaseExpression()INTERNAL: Used for nested joining and partial objects. |
int |
getCacheUsage()PUBLIC: Return the cache usage. |
short |
getDistinctState()ADVANCED: If a distinct has been set the DISTINCT clause will be printed. |
java.lang.Object |
getExampleObject()PUBLIC: This method returns the current example object. |
ExpressionBuilder |
getExpressionBuilder()REQUIRED: Get the expression builder which should be used for this query. |
InMemoryQueryIndirectionPolicy |
getInMemoryQueryIndirectionPolicy()PUBLIC: Returns the InMemoryQueryIndirectionPolicy for this query |
java.util.Vector |
getJoinedAttributeExpressions()INTERNAL: Return the attributes that must be joined. |
Descriptor |
getLeafDescriptorFor(Expression expression, Descriptor rootDescriptor)INTERNAL: Lookup the descriptor for this item by traversing its expression recursively. |
DatabaseMapping |
getLeafMappingFor(Expression expression, Descriptor rootDescriptor)INTERNAL: Lookup the mapping for this item by traversing its expression recursively. |
short |
getLockMode()PUBLIC: Return the current locking mode. |
java.util.Vector |
getPartialAttributeExpressions()INTERNAL: Return the partial attributes to select. |
java.util.Vector |
getPartialAttributeExpressionsWithoutKeyFields(Descriptor descriptor)INTERNAL: This method was created in VisualAge. |
QueryByExamplePolicy |
getQueryByExamplePolicy()PUBLIC: When using Query By Example, an instance of QueryByExamplePolicy is used to customize the query. |
java.lang.Class |
getReferenceClass()PUBLIC: Return the reference class of the query. |
oracle.toplink.tools.workbench.expressions.ExpressionRepresentation |
getSelectionCriteriaForPersistence()INTERNAL: Used by TopLink to persist the expression into XML. |
boolean |
hasJoinedAttributes()INTERNAL: Return if any attributes are joined. |
boolean |
hasPartialAttributeExpressions()INTERNAL: Return if partial attributes. |
boolean |
isAttributeJoined(java.lang.String attributeName)INTERNAL: Return if the attribute is specified for joining. |
boolean |
isDistinctComputed()INTERNAL: return true if this query has computed its distinct value already |
boolean |
isLockQuery()PUBLIC: Return true if query is in any lockMode other than NO_LOCK |
boolean |
isObjectLevelReadQuery()PUBLIC: Return if this is an object level read query. |
boolean |
isPartialAttribute(java.lang.String attributeName)INTERNAL: Return if partial attribute. |
void |
refreshIdentityMapResult()PUBLIC: Refresh the attributes of the object(s) resulting from the query. |
void |
refreshRemoteIdentityMapResult()PUBLIC: Refresh the attributes of the object(s) resulting from the query. |
abstract java.lang.Object |
registerObjectInUnitOfWork(java.lang.Object object, oracle.toplink.publicinterface.UnitOfWork session, DatabaseRow databaseRow)INTERNAL: Allow for unit of work registration. |
void |
resetDistinct()ADVANCED: If a distinct has been set the DISTINCT clause will be printed. |
void |
setAdditionalFields(java.util.Vector additionalFields)INTERNAL: Additional fields can be added to a query. |
void |
setBaseExpression(oracle.toplink.internal.expressions.QueryKeyExpression baseExpression)INTERNAL: Used for nested joining and partial objects. |
void |
setCacheUsage(int cacheUsage)PUBLIC: Set the cache usage. |
void |
setDistinctState(short distinctState)ADVANCED: If a distinct has been set the DISTINCT clause will be printed. |
void |
setExampleObject(java.lang.Object newExampleObject)PUBLIC: Set the example object of the query to be the newExampleObject. |
void |
setInMemoryQueryIndirectionPolicy(InMemoryQueryIndirectionPolicy inMemoryQueryIndirectionPolicy)PUBLIC: Set the InMemoryQueryIndirectionPolicy for this query |
void |
setJoinedAttributeExpressions(java.util.Vector joinedAttributeExpressions)INTERNAL: Set the attributes that must be joined. |
void |
setLockMode(short lockMode)PUBLIC: Set the lock mode of the query NO_LOCK, LOCK, or LOCK_NOWAIT (default=NO_LOCK) |
void |
setPartialAttributeExpressions(java.util.Vector partialAttributeExpressions)INTERNAL: Set the partial attributes to select. |
void |
setQueryByExamplePolicy(QueryByExamplePolicy queryByExamplePolicy)PUBLIC: The QueryByExamplePolicy, is a useful to customize the query when Query By Example is used. |
void |
setReferenceClass(java.lang.Class aClass)REQUIRED: Set the reference class for the query. |
void |
setSelectionCriteriaFromPersistence(oracle.toplink.tools.workbench.expressions.ExpressionRepresentation representation)INTERNAL: Used by TopLink to set the expression from XML. |
void |
setShouldIncludeData(boolean shouldIncludeData)INTERNAL: Set if the rows for the result of the query should also be returned using a complex query result. |
void |
setShouldRefreshIdentityMapResult(boolean shouldRefreshIdentityMapResult)PUBLIC: Set if the attributes of the object(s) resulting from the query should be refreshed. |
void |
setShouldRefreshRemoteIdentityMapResult(boolean shouldRefreshIdentityMapResult)PUBLIC: Set if the attributes of the object(s) resulting from the query should be refreshed. |
boolean |
shouldCheckCacheOnly()PUBLIC: Return if cache should be checked. |
boolean |
shouldConformResultsInUnitOfWork()PUBLIC: Return if cache should be checked. |
boolean |
shouldDistinctBeUsed()INTERNAL: return true if this query should use a distinct |
boolean |
shouldIncludeData()INTERNAL: Return if the rows for the result of the query should also be returned using a complex query result. |
boolean |
shouldReadMapping(DatabaseMapping mapping)INTERNAL: Check if the mapping is part of the partial attributes. |
boolean |
shouldRefreshIdentityMapResult()PUBLIC: Set to a boolean. |
boolean |
shouldRefreshRemoteIdentityMapResult()PUBLIC: Set to a boolean. |
java.lang.String |
toString() |
void |
useDistinct()ADVANCED: If a distinct has been set the DISTINCT clause will be printed. |
| Methods inherited from class oracle.toplink.queryframework.ReadQuery |
cacheQueryResults, clearQueryResults, doNotCacheQueryResults, execute, getMaxRows, getQueryId, isReadQuery, remoteExecute, setMaxRows, setQueryId, setShouldCacheQueryResults, shouldCacheQueryResults |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int DoNotCheckCache
public static final int CheckCacheByExactPrimaryKey
public static final int CheckCacheByPrimaryKey
public static final int CheckCacheThenDatabase
public static final int CheckCacheOnly
public static final int ConformResultsInUnitOfWork
public static final short NO_LOCK
public static final short LOCK
public static final short LOCK_NOWAIT
public static final short UNCOMPUTED_DISTINCT
public static final short USE_DISTINCT
public static final short DONT_USE_DISTINCT
public InMemoryQueryIndirectionPolicy inMemoryQueryIndirectionPolicy
| Constructor Detail |
public ObjectLevelReadQuery()
| Method Detail |
public void acquireLocks()
public void acquireLocksWithoutWaiting()
public void addAdditionalField(oracle.toplink.internal.helper.DatabaseField field)
public void addAdditionalField(Expression fieldExpression)
public void addJoinedAttribute(java.lang.String attributeName)
Note: This cannot be used for objects where it is possible not to have a part, as these objects will be ommited from the result set, unless an outer join is used through passing and expression using "getAllowingNull".
Example: query.addJoinedAttribute("address")
addJoinedAttribute(Expression), ReadAllQuery.addBatchReadAttribute(Expression)public void addJoinedAttribute(Expression attributeExpression)
Note: This cannot be used for objects where it is possible not to have a part, as these objects will be ommited from the result set, unless an outer join is used through passing and expression using "getAllowingNull".
Example: query.addJoinedAttribute(query.getExpressionBuilder().get("teamLeader").get("address"))
ReadAllQuery.addBatchReadAttribute(String)public void addPartialAttribute(java.lang.String attributeName)
This allows for the query to be optimized through selecting less data.
Partial objects will be returned from the query, where the unspecified attributes will be left null. The primary key will always be selected to allow re-querying of the whole object.
Note: Because the object is not fully initialized it cannot be cached, and cannot be edited.
Note: You cannot have 2 partial attributes of the same type. You also cannot add a partial attribute which is of the same type as the class being queried.
Example: query.addPartialAttribute("firstName")
addPartialAttribute(Expression)public void addPartialAttribute(Expression attributeExpression)
This allows for the query to be optimized through selecting less data.
Partial objects will be returned from the query, where the unspecified attributes will be left null. The primary key will always be selected to allow re-querying of the whole object.
Note: Because the object is not fully initialized it cannot be cached, and cannot be edited.
Note: You cannot have 2 partial attributes of the same type. You also cannot add a partial attribute which is of the same type as the class being queried.
Example: query.addPartialAttribute(query.getExpressionBuilder().get("address").get("city"))
public java.lang.Object buildObject(DatabaseRow row)
buildObject in class ReadQuerypublic void checkCacheOnly()
setCacheUsage(int)
public void checkDescriptor(oracle.toplink.publicinterface.Session session)
throws QueryException
QueryExceptionpublic void changeDescriptor(oracle.toplink.publicinterface.Session theSession)
public void conformResultsInUnitOfWork()
setCacheUsage(int)public void dontAcquireLocks()
public void dontCheckCache()
public void dontRefreshIdentityMapResult()
public void dontRefreshRemoteIdentityMapResult()
public void dontUseDistinct()
public java.util.Vector getAdditionalFields()
public oracle.toplink.internal.expressions.QueryKeyExpression getBaseExpression()
public int getCacheUsage()
Valid values are:
public short getDistinctState()
public java.lang.Object getExampleObject()
public ExpressionBuilder getExpressionBuilder()
public InMemoryQueryIndirectionPolicy getInMemoryQueryIndirectionPolicy()
public java.util.Vector getJoinedAttributeExpressions()
public DatabaseMapping getLeafMappingFor(Expression expression, Descriptor rootDescriptor) throws QueryException
QueryExceptionpublic Descriptor getLeafDescriptorFor(Expression expression, Descriptor rootDescriptor) throws QueryException
expression -rootDescriptor -QueryExceptionpublic short getLockMode()
public java.util.Vector getPartialAttributeExpressions()
public java.util.Vector getPartialAttributeExpressionsWithoutKeyFields(Descriptor descriptor)
descriptor - Descriptor J.D. Only return the partial attributes not included in the descriptor as key fields If the partial attribute is a key field for the object, it will automatically be added to the select statement.public QueryByExamplePolicy getQueryByExamplePolicy()
public java.lang.Class getReferenceClass()
getReferenceClass in class DatabaseQuerypublic oracle.toplink.tools.workbench.expressions.ExpressionRepresentation getSelectionCriteriaForPersistence()
public boolean hasJoinedAttributes()
public boolean hasPartialAttributeExpressions()
public boolean isAttributeJoined(java.lang.String attributeName)
public boolean isDistinctComputed()
public boolean isLockQuery()
public boolean isObjectLevelReadQuery()
isObjectLevelReadQuery in class DatabaseQuerypublic boolean isPartialAttribute(java.lang.String attributeName)
public void refreshIdentityMapResult()
public void refreshRemoteIdentityMapResult()
public abstract java.lang.Object registerObjectInUnitOfWork(java.lang.Object object,
oracle.toplink.publicinterface.UnitOfWork session,
DatabaseRow databaseRow)
public void resetDistinct()
public void setAdditionalFields(java.util.Vector additionalFields)
public void setBaseExpression(oracle.toplink.internal.expressions.QueryKeyExpression baseExpression)
public void setCacheUsage(int cacheUsage)
Valid values are:
public void setDistinctState(short distinctState)
public void setExampleObject(java.lang.Object newExampleObject)
If a query already has a selection criteria this criteria and the generated query by example criteria will be conjuncted.
Once a query is executed you must make an explicit call to setExampleObject if the example object is changed, so the query will know to prepare itself again.
There is a caution to setting both a selection criteria and an example object: Only in this case if you set the example object again after execution you must then also reset the selection criteria. (This is because after execution the original criteria and Query By Example criteria were fused together, and the former cannot be easily recovered from the now invalid result).
public void setInMemoryQueryIndirectionPolicy(InMemoryQueryIndirectionPolicy inMemoryQueryIndirectionPolicy)
public void setJoinedAttributeExpressions(java.util.Vector joinedAttributeExpressions)
public void setLockMode(short lockMode)
public void setPartialAttributeExpressions(java.util.Vector partialAttributeExpressions)
public void setQueryByExamplePolicy(QueryByExamplePolicy queryByExamplePolicy)
Once a query is executed you must make an explicit call to setQueryByExamplePolicy when changing the policy, so the query will know to prepare itself again.
There is a caution to setting both a selection criteria and an example object: If you set the policy after execution you must also reset the selection criteria. (This is because after execution the original criteria and Query By Example criteria are fused together, and the former cannot be easily recovered).
public void setReferenceClass(java.lang.Class aClass)
public void setSelectionCriteriaFromPersistence(oracle.toplink.tools.workbench.expressions.ExpressionRepresentation representation)
public void setShouldIncludeData(boolean shouldIncludeData)
ComplexQueryResultpublic void setShouldRefreshIdentityMapResult(boolean shouldRefreshIdentityMapResult)
public void setShouldRefreshRemoteIdentityMapResult(boolean shouldRefreshIdentityMapResult)
public boolean shouldCheckCacheOnly()
public boolean shouldConformResultsInUnitOfWork()
public boolean shouldDistinctBeUsed()
public boolean shouldIncludeData()
ComplexQueryResultpublic boolean shouldReadMapping(DatabaseMapping mapping)
public boolean shouldRefreshIdentityMapResult()
public boolean shouldRefreshRemoteIdentityMapResult()
public java.lang.String toString()
toString in class DatabaseQuerypublic void useDistinct()
|
| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||