|
Oracle Fusion Middleware Java API Reference for Oracle TopLink (Deprecated) 11g Release 1 (11.1.1) B32476-04 |
||||||||
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.ObjectBuildingQuery oracle.toplink.queryframework.ObjectLevelReadQuery oracle.toplink.queryframework.ReadAllQuery oracle.toplink.queryframework.ReportQuery
public class 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:
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. |
static int |
ShouldReturnWithoutReportQueryResult
For EJB 3 support returns results without using the ReportQueryResult |
Fields inherited from class oracle.toplink.queryframework.ObjectLevelReadQuery |
---|
CheckCacheByExactPrimaryKey, CheckCacheByPrimaryKey, CheckCacheOnly, CheckCacheThenDatabase, ConformResultsInUnitOfWork, DoNotCheckCache, DONT_USE_DISTINCT, UNCOMPUTED_DISTINCT, USE_DISTINCT, UseDescriptorSetting |
Fields inherited from class oracle.toplink.queryframework.ObjectBuildingQuery |
---|
DEFAULT_LOCK_MODE, LOCK, LOCK_NOWAIT, NO_LOCK |
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)
The report query is require to be constructor with an expression builder. |
|
ReportQuery(ExpressionBuilder builder)
The report query is require to be constructor with an expression builder. |
Method Summary | |
---|---|
void |
addAttribute(java.lang.String itemName)
Add the attribute from the reference class to be included in the result. |
void |
addAttribute(java.lang.String itemName,
Expression attributeExpression)
Add the attribute to be included in the result. |
void |
addAttribute(java.lang.String itemName,
Expression attributeExpression,
java.lang.Class type)
Add the attribute to be included in the result. |
void |
addAverage(java.lang.String itemName)
Add the average value of the attribute to be included in the result. |
void |
addAverage(java.lang.String itemName,
java.lang.Class resultType)
Add the average value of the attribute to be included in the result and return it as the specified resultType. |
void |
addAverage(java.lang.String itemName,
Expression attributeExpression)
Add the average value of the attribute to be included in the result. |
void |
addAverage(java.lang.String itemName,
Expression attributeExpression,
java.lang.Class resultType)
Add the average value of the attribute to be included in the result and return it as the specified resultType. |
void |
addConstructorReportItem(ConstructorReportItem item)
Add a ConstructorReportItem to this query's set of return values. |
void |
addCount()
Include the number of rows returned by the query in the result. |
void |
addCount(java.lang.String attributeName)
Include the number of rows returned by the query in the result, where attributeExpression is not null. |
void |
addCount(java.lang.String attributeName,
java.lang.Class resultType)
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)
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,
java.lang.Class resultType)
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)
Add the attribute expression to the group by expressions. |
void |
addGrouping(java.lang.String attributeName)
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 |
addItem(java.lang.String itemName,
Expression attributeExpression,
java.util.List joinedExpressions)
ADVANCED: Add the expression value to be included in the result. |
void |
addMaximum(java.lang.String itemName)
Add the maximum value of the attribute to be included in the result. |
void |
addMaximum(java.lang.String itemName,
Expression attributeExpression)
Add the maximum value of the attribute to be included in the result. |
void |
addMinimum(java.lang.String itemName)
Add the minimum value of the attribute to be included in the result. |
void |
addMinimum(java.lang.String itemName,
Expression attributeExpression)
Add the minimum value of the attribute to be included in the result. |
void |
addStandardDeviation(java.lang.String itemName)
Add the standard deviation value of the attribute to be included in the result. |
void |
addStandardDeviation(java.lang.String itemName,
Expression attributeExpression)
Add the standard deviation value of the attribute to be included in the result. |
void |
addSum(java.lang.String itemName)
Add the sum value of the attribute to be included in the result. |
void |
addSum(java.lang.String itemName,
java.lang.Class resultType)
Add the sum value of the attribute to be included in the result and return it as the specified resultType. |
void |
addSum(java.lang.String itemName,
Expression attributeExpression)
Add the sum value of the attribute to be included in the result. |
void |
addSum(java.lang.String itemName,
Expression attributeExpression,
java.lang.Class resultType)
Add the sum value of the attribute to be included in the result and return it as the specified resultType. |
void |
addVariance(java.lang.String itemName)
Add the variance value of the attribute to be included in the result. |
void |
addVariance(java.lang.String itemName,
Expression attributeExpression)
Add the variance value of the attribute to be included in the result. |
ConstructorReportItem |
beginAddingConstructorArguments(java.lang.Class constructorClass)
Call a constructor for the given class with the results of this query. |
ConstructorReportItem |
beginAddingConstructorArguments(java.lang.Class constructorClass,
java.lang.Class[] constructorArgTypes)
Call a constructor for the given class with the results of this query. |
void |
dontRetrievePrimaryKeys()
Set if the query results should contain the primary keys or each associated object. |
void |
dontReturnSingleAttribute()
Don't simplify the result by returning the single attribute. |
void |
dontReturnSingleResult()
Simplifies the result by only returning the first result. |
void |
dontReturnSingleValue()
Simplifies the result by only returning a single value. |
void |
dontReturnWithoutReportQueryResult()
Simplifies the result by only returning a single value. |
void |
endAddingToConstructorItem()
Used in conjunction with beginAddingConstructorArguments to signal that expressions should no longer be be added to the collection used in the constructor Get the rows and build the object from the rows. |
boolean |
isReportQuery()
Return if this is a report query. |
void |
retrievePrimaryKeys()
Set if the query results should contain the primary keys or each associated object. |
void |
returnSingleAttribute()
Simplify the result by returning a single attribute. |
void |
returnSingleResult()
Simplifies the result by only returning the first result. |
void |
returnSingleValue()
Simplifies the result by only returning a single value. |
void |
returnWithoutReportQueryResult()
Simplifies the result by only returning a single value. |
void |
setHavingExpression(Expression expression)
Add the expression to the query to be used in the HAVING clause. |
void |
setShouldRetrieveFirstPrimaryKey(boolean shouldRetrieveFirstPrimaryKey)
ADVANCED: Sets if the query results should contain the first primary key of each associated object. |
void |
setShouldRetrievePrimaryKeys(boolean shouldRetrievePrimaryKeys)
Set if the query results should contain the primary keys or each associated object. |
void |
setShouldReturnSingleAttribute(boolean newChoice)
Simplifies the result by only returning the attribute (as opposed to wrapping in a ReportQueryResult). |
void |
setShouldReturnSingleResult(boolean newChoice)
Simplifies the result by only returning the first result. |
void |
setShouldReturnSingleValue(boolean newChoice)
Simplifies the result by only returning a single value. |
void |
setShouldReturnWithoutReportQueryResult(boolean newChoice)
Simplifies the result by returning a nested list instead of the ReportQueryResult. |
boolean |
shouldRetrieveFirstPrimaryKey()
Return if the query results should contain the first primary key of each associated object. |
boolean |
shouldRetrievePrimaryKeys()
Return if the query results should contain the primary keys or each associated object. |
boolean |
shouldReturnSingleAttribute()
Answer if we are only returning the attribute (as opposed to wrapping in a ReportQueryResult). |
boolean |
shouldReturnSingleResult()
Simplifies the result by only returning the first result. |
boolean |
shouldReturnSingleValue()
Simplifies the result by only returning a single value. |
boolean |
shouldReturnWithoutReportQueryResult()
Simplifies the result by returning a nested list instead of the ReportQueryResult. |
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.ObjectBuildingQuery |
---|
isObjectBuildingQuery, setShouldUseExclusiveConnection, shouldUseExclusiveConnection |
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 |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int ShouldReturnSingleResult
ReportQuery
public static final int ShouldReturnSingleValue
ReportQuery
public static final int ShouldReturnSingleAttribute
ReportQuery
public static final int ShouldReturnWithoutReportQueryResult
ReportQuery
public static final int FULL_PRIMARY_KEY
ReportQuery
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 addAttribute(java.lang.String itemName, Expression attributeExpression, java.lang.Class type)
public void addAverage(java.lang.String itemName)
public void addAverage(java.lang.String itemName, java.lang.Class resultType)
public void addAverage(java.lang.String itemName, Expression attributeExpression)
public void addAverage(java.lang.String itemName, Expression attributeExpression, java.lang.Class resultType)
public void addConstructorReportItem(ConstructorReportItem item)
ConstructorReportItem
- - used to specify a class constructor and values to pass in from this queryConstructorReportItem
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 attributeName, java.lang.Class resultType)
Example:
TopLink: reportQuery.addCount("id", Long.class); 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.
objectAttributes can be specified also, even accross many to many mappings.TopLink: reportQuery.addCount("Count", getExpressionBuilder().get("address").distinct()); SQL: SELECT COUNT (DISTINCT t0.ADDR_ID) FROM EMPLOYEE t0, ...
addCount()
public void addCount(java.lang.String itemName, Expression attributeExpression, java.lang.Class resultType)
Example:
TopLink: reportQuery.addCount("Count", getExpressionBuilder().get("id"), Integer.class); SQL: SELECT COUNT (t0.EMP_ID) FROM EMPLOYEE t0, ...
Example: counting only distinct values of an attribute.
objectAttributes can be specified also, even accross many to many mappings.TopLink: reportQuery.addCount("Count", getExpressionBuilder().get("address").distinct()); SQL: SELECT COUNT (DISTINCT t0.ADDR_ID) FROM EMPLOYEE t0, ...
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 setHavingExpression(Expression expression)
Example:
reportQuery.setHavingExpression(expBuilder.get("address").get("country").equal("Canada"))
public void addItem(java.lang.String itemName, Expression attributeExpression)
public void addItem(java.lang.String itemName, Expression attributeExpression, java.util.List joinedExpressions)
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, java.lang.Class resultType)
public void addSum(java.lang.String itemName, Expression attributeExpression)
public void addSum(java.lang.String itemName, Expression attributeExpression, java.lang.Class resultType)
public void addVariance(java.lang.String itemName)
public void addVariance(java.lang.String itemName, Expression attributeExpression)
public ConstructorReportItem beginAddingConstructorArguments(java.lang.Class constructorClass)
constructorClass
- public ConstructorReportItem beginAddingConstructorArguments(java.lang.Class constructorClass, java.lang.Class[] constructorArgTypes)
constructorClass
- constructorArgTypes
- - sets the argument types to be passed to the constructor.public void dontRetrievePrimaryKeys()
public void dontReturnSingleAttribute()
public void dontReturnSingleResult()
public void dontReturnSingleValue()
public void dontReturnWithoutReportQueryResult()
public void endAddingToConstructorItem()
DatabaseException
- - an error has occurred on the databasepublic boolean isReportQuery()
isReportQuery
in class DatabaseQuery
public void retrievePrimaryKeys()
public void returnSingleAttribute()
public void returnSingleResult()
public void returnSingleValue()
public void returnWithoutReportQueryResult()
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 void setShouldReturnWithoutReportQueryResult(boolean newChoice)
public boolean shouldRetrievePrimaryKeys()
public boolean shouldRetrieveFirstPrimaryKey()
public boolean shouldReturnSingleAttribute()
public boolean shouldReturnSingleResult()
public boolean shouldReturnSingleValue()
public boolean shouldReturnWithoutReportQueryResult()
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |