|
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 |
java.lang.Object
oracle.toplink.queryframework.DatabaseQuery
oracle.toplink.queryframework.ReadQuery
oracle.toplink.queryframework.ObjectLevelReadQuery
oracle.toplink.queryframework.ReadAllQuery
oracle.toplink.queryframework.ReportQuery
Purpose: Query for information about a set of objects instead of the objects themselves. This supports select single attributes, nested attributes, aggregation functions and group bys.
Attribute Types:
Retrieving Primary Keys: It is possble to retrieve the primary key raw values within each result, but stored in a separate (internal) vector. This primary key vector can later be used to retrieve the real object.
retrievePrimaryKeys()
, If the values are wanted in the result array then they must be added as attributes. For primary keys which are not mapped directly you can add them as DatabaseFields (see above).
, Serialized FormField Summary | |
static int |
FIRST_PRIMARY_KEY |
static int |
FULL_PRIMARY_KEY Specifies whether to retreive primary keys, first primary key, or no primary key. |
static int |
NO_PRIMARY_KEY |
static int |
ShouldReturnSingleAttribute Simplifies the result by only returning the single attribute(as opposed to wrapping in a ReportQueryResult). |
static int |
ShouldReturnSingleResult Simplifies the result by only returning the first result. |
static int |
ShouldReturnSingleValue Simplifies the result by only returning one value. |
Fields inherited from class oracle.toplink.queryframework.ObjectLevelReadQuery |
CheckCacheByExactPrimaryKey, CheckCacheByPrimaryKey, CheckCacheOnly, CheckCacheThenDatabase, ConformResultsInUnitOfWork, DEFAULT_LOCK_MODE, DoNotCheckCache, DONT_USE_DISTINCT, LOCK, LOCK_NOWAIT, NO_LOCK, UNCOMPUTED_DISTINCT, USE_DISTINCT, UseDescriptorSetting |
Fields inherited from class oracle.toplink.queryframework.DatabaseQuery |
CascadeAggregateDelete, CascadeAllParts, CascadeByMapping, CascadeDependentParts, CascadePrivateParts, NoCascading |
Constructor Summary | |
ReportQuery(java.lang.Class javaClass, Expression expression) |
|
ReportQuery(java.lang.Class javaClass, ExpressionBuilder builder) PUBLIC: The report query is require to be constructor with an expression builder. |
|
ReportQuery(ExpressionBuilder builder) PUBLIC: The report query is require to be constructor with an expression builder. |
Method Summary | |
void |
addAttribute(java.lang.String itemName) PUBLIC: Add the attribute from the reference class to be included in the result. |
void |
addAttribute(java.lang.String itemName, Expression attributeExpression) PUBLIC: Add the attribute to be included in the result. |
void |
addAverage(java.lang.String itemName) PUBLIC: Add the average value of the attribute to be included in the result. |
void |
addAverage(java.lang.String itemName, Expression attributeExpression) PUBLIC: Add the average value of the attribute to be included in the result. |
void |
addCount() PUBLIC: Include the number of rows returned by the query in the result. |
void |
addCount(java.lang.String attributeName) PUBLIC: Include the number of rows returned by the query in the result, where attributeExpression is not null. |
void |
addCount(java.lang.String itemName, Expression attributeExpression) PUBLIC: Include the number of rows returned by the query in the result, where attributeExpression is not null. |
void |
addFunctionItem(java.lang.String itemName, Expression attributeExpression, java.lang.String functionName) ADVANCED: Add the function against the attribute expression to be included in the result. |
void |
addGrouping(Expression expression) PUBLIC: Add the attribute expression to the group by expressions. |
void |
addGrouping(java.lang.String attributeName) PUBLIC: Add the attribute to the group by expressions. |
void |
addItem(java.lang.String itemName, Expression attributeExpression) ADVANCED: Add the expression value to be included in the result. |
void |
addMaximum(java.lang.String itemName) PUBLIC: Add the maximum value of the attribute to be included in the result. |
void |
addMaximum(java.lang.String itemName, Expression attributeExpression) PUBLIC: Add the maximum value of the attribute to be included in the result. |
void |
addMinimum(java.lang.String itemName) PUBLIC: Add the minimum value of the attribute to be included in the result. |
void |
addMinimum(java.lang.String itemName, Expression attributeExpression) PUBLIC: Add the minimum value of the attribute to be included in the result. |
void |
addStandardDeviation(java.lang.String itemName) PUBLIC: Add the standard deviation value of the attribute to be included in the result. |
void |
addStandardDeviation(java.lang.String itemName, Expression attributeExpression) PUBLIC: Add the standard deviation value of the attribute to be included in the result. |
void |
addSum(java.lang.String itemName) PUBLIC: Add the sum value of the attribute to be included in the result. |
void |
addSum(java.lang.String itemName, Expression attributeExpression) PUBLIC: Add the sum value of the attribute to be included in the result. |
void |
addVariance(java.lang.String itemName) PUBLIC: Add the variance value of the attribute to be included in the result. |
void |
addVariance(java.lang.String itemName, Expression attributeExpression) PUBLIC: Add the variance value of the attribute to be included in the result. |
void |
dontRetrievePrimaryKeys() PUBLIC: Set if the query results should contain the primary keys or each associated object. |
void |
dontReturnSingleAttribute() PUBLIC: Don't simplify the result by returning the single attribute. |
void |
dontReturnSingleResult() PUBLIC: Simplifies the result by only returning the first result. |
void |
dontReturnSingleValue() PUBLIC: Simplifies the result by only returning a single value. |
boolean |
isReportQuery() PUBLIC: Return if this is a report query. |
void |
retrievePrimaryKeys() PUBLIC: Set if the query results should contain the primary keys or each associated object. |
void |
returnSingleAttribute() PUBLIC: Simplify the result by returning a single attribute. |
void |
returnSingleResult() PUBLIC: Simplifies the result by only returning the first result. |
void |
returnSingleValue() PUBLIC: Simplifies the result by only returning a single value. |
void |
setShouldRetrieveFirstPrimaryKey(boolean shouldRetrieveFirstPrimaryKey) ADVANCED: Sets if the query results should contain the first primary key of each associated object. |
void |
setShouldRetrievePrimaryKeys(boolean shouldRetrievePrimaryKeys) PUBLIC: Set if the query results should contain the primary keys or each associated object. |
void |
setShouldReturnSingleAttribute(boolean newChoice) PUBLIC: Simplifies the result by only returning the attribute (as opposed to wrapping in a ReportQueryResult). |
void |
setShouldReturnSingleResult(boolean newChoice) PUBLIC: Simplifies the result by only returning the first result. |
void |
setShouldReturnSingleValue(boolean newChoice) PUBLIC: Simplifies the result by only returning a single value. |
boolean |
shouldRetrieveFirstPrimaryKey() PUBLIC: Return if the query results should contain the first primary key of each associated object. |
boolean |
shouldRetrievePrimaryKeys() PUBLIC: Return if the query results should contain the primary keys or each associated object. |
boolean |
shouldReturnSingleAttribute() PUBLIC: Answer if we are only returning the attribute (as opposed to wrapping in a ReportQueryResult). |
boolean |
shouldReturnSingleResult() PUBLIC: Simplifies the result by only returning the first result. |
boolean |
shouldReturnSingleValue() PUBLIC: Simplifies the result by only returning a single value. |
Methods inherited from class oracle.toplink.queryframework.ReadAllQuery |
addAscendingOrdering, addBatchReadAttribute, addBatchReadAttribute, addDescendingOrdering, addOrdering, getConnectByExpression, getOrderSiblingsByExpressions, getStartWithExpression, isReadAllQuery, setContainerPolicy, setHierarchicalQueryClause, useCollectionClass, useCursoredStream, useCursoredStream, useCursoredStream, useMapClass, useScrollableCursor, useScrollableCursor, useScrollableCursor |
Methods inherited from class oracle.toplink.queryframework.ReadQuery |
cacheQueryResults, clearQueryResults, clearQueryResults, doNotCacheQueryResults, getFetchSize, getFirstResult, getMaxRows, getQueryResultsCachePolicy, isReadQuery, setFetchSize, setFirstResult, setMaxRows, setQueryResultsCachePolicy, setShouldCacheQueryResults, shouldCacheQueryResults |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int ShouldReturnSingleResult
public static final int ShouldReturnSingleValue
public static final int ShouldReturnSingleAttribute
public static final int FULL_PRIMARY_KEY
public static final int FIRST_PRIMARY_KEY
public static final int NO_PRIMARY_KEY
Constructor Detail |
public ReportQuery(java.lang.Class javaClass, Expression expression)
public ReportQuery(java.lang.Class javaClass, ExpressionBuilder builder)
public ReportQuery(ExpressionBuilder builder)
Method Detail |
public void addAttribute(java.lang.String itemName)
public void addAttribute(java.lang.String itemName, Expression attributeExpression)
public void addAverage(java.lang.String itemName)
public void addAverage(java.lang.String itemName, Expression attributeExpression)
public void addCount()
addCount(java.lang.String)
public void addCount(java.lang.String attributeName)
Example:
TopLink: reportQuery.addCount("id"); SQL: SELECT COUNT (t0.EMP_ID) FROM EMPLOYEE t0, ...
attributeName
- the number of rows where attributeName is not null will be returned.addCount(java.lang.String, oracle.toplink.expressions.Expression)
public void addCount(java.lang.String itemName, Expression attributeExpression)
Example:
TopLink: reportQuery.addCount("Count", getExpressionBuilder().get("id")); SQL: SELECT COUNT (t0.EMP_ID) FROM EMPLOYEE t0, ...
Example: counting only distinct values of an attribute.
TopLink: reportQuery.addCount("Count", getExpressionBuilder().get("address").distinct()); SQL: SELECT COUNT (DISTINCT t0.ADDR_ID) FROM EMPLOYEE t0, ...objectAttributes can be specified also, even accross many to many mappings.
addCount()
public void addFunctionItem(java.lang.String itemName, Expression attributeExpression, java.lang.String functionName)
public void addGrouping(java.lang.String attributeName)
public void addGrouping(Expression expression)
public void addItem(java.lang.String itemName, Expression attributeExpression)
public void addMaximum(java.lang.String itemName)
public void addMaximum(java.lang.String itemName, Expression attributeExpression)
public void addMinimum(java.lang.String itemName)
public void addMinimum(java.lang.String itemName, Expression attributeExpression)
public void addStandardDeviation(java.lang.String itemName)
public void addStandardDeviation(java.lang.String itemName, Expression attributeExpression)
public void addSum(java.lang.String itemName)
public void addSum(java.lang.String itemName, Expression attributeExpression)
public void addVariance(java.lang.String itemName)
public void addVariance(java.lang.String itemName, Expression attributeExpression)
public void dontRetrievePrimaryKeys()
public void dontReturnSingleAttribute()
public void dontReturnSingleResult()
public void dontReturnSingleValue()
public boolean isReportQuery()
isReportQuery
in class DatabaseQuery
public void retrievePrimaryKeys()
public void returnSingleAttribute()
public void returnSingleResult()
public void returnSingleValue()
public void setShouldRetrievePrimaryKeys(boolean shouldRetrievePrimaryKeys)
public void setShouldRetrieveFirstPrimaryKey(boolean shouldRetrieveFirstPrimaryKey)
public void setShouldReturnSingleAttribute(boolean newChoice)
public void setShouldReturnSingleResult(boolean newChoice)
public void setShouldReturnSingleValue(boolean newChoice)
public boolean shouldRetrievePrimaryKeys()
public boolean shouldRetrieveFirstPrimaryKey()
public boolean shouldReturnSingleAttribute()
public boolean shouldReturnSingleResult()
public boolean shouldReturnSingleValue()
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |