Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

B32476-03

oracle.toplink.queryframework
Class ReportQuery

java.lang.Object
  extended by oracle.toplink.queryframework.DatabaseQuery
      extended by oracle.toplink.queryframework.ReadQuery
          extended by oracle.toplink.queryframework.ObjectBuildingQuery
              extended by oracle.toplink.queryframework.ObjectLevelReadQuery
                  extended by oracle.toplink.queryframework.ReadAllQuery
                      extended by oracle.toplink.queryframework.ReportQuery
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, oracle.toplink.internal.helper.FalseUndefinedTrue

public class ReportQuery
extends ReadAllQuery

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:

  1. addAttribute("directQueryKey") is a short cut method to add an attribute with the same name as its corresponding direct query key.
  2. addAttribute("attributeName", expBuilder.get("oneToOneMapping").get("directQueryKey")) is the full approach for get values through joined 1:1 relationships.
  3. addAttribute("attributeName", expBuilder.getField("TABLE.FIELD")) allows the addition of raw values or values which were not mapped in the object model directly (i.e. FK attributes).
  4. addAttribute("attributeName", null) Leave a place holder (NULL) value in the result (used for included values from other systems or calculated values).
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.

Since:
TOPLink/Java 2.0
See Also:
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 Form

Field 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.ObjectLevelReadQuery
acquireLocks, acquireLocksWithoutWaiting, addJoinedAttribute, addJoinedAttribute, addNonFetchJoinedAttribute, addNonFetchJoinedAttribute, addPartialAttribute, addPartialAttribute, checkCacheOnly, conformResultsInUnitOfWork, dontAcquireLocks, dontCheckCache, dontRefreshIdentityMapResult, dontRefreshRemoteIdentityMapResult, dontUseDistinct, getAsOfClause, getCacheUsage, getDistinctState, getExampleObject, getExpressionBuilder, getFetchGroup, getFetchGroupName, getInMemoryQueryIndirectionPolicy, getInMemoryQueryIndirectionPolicyState, getLockMode, getQueryByExamplePolicy, getReferenceClass, hasAsOfClause, hasFetchGroup, isLockQuery, isLockQuery, isObjectLevelReadQuery, isReadOnly, isResultSetOptimizedQuery, refreshIdentityMapResult, refreshRemoteIdentityMapResult, resetDistinct, setAsOfClause, setCacheUsage, setDistinctState, setEJBQLString, setExampleObject, setFetchGroup, setFetchGroupName, setInMemoryQueryIndirectionPolicy, setInMemoryQueryIndirectionPolicyState, setIsReadOnly, setIsResultSetOptimizedQuery, setLockMode, setQueryByExamplePolicy, setReferenceClass, setSelectionCriteria, setShouldFilterDuplicates, setShouldOuterJoinSubclasses, setShouldProcessResultsInUnitOfWork, setShouldRefreshIdentityMapResult, setShouldRefreshRemoteIdentityMapResult, setShouldUseDefaultFetchGroup, shouldCheckCacheOnly, shouldCheckDescriptorForCacheUsage, shouldConformResultsInUnitOfWork, shouldFilterDuplicates, shouldOuterJoinSubclasses, shouldProcessResultsInUnitOfWork, shouldRefreshIdentityMapResult, shouldRefreshRemoteIdentityMapResult, shouldUseDefaultFetchGroup, toString, useDistinct
 
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 oracle.toplink.queryframework.DatabaseQuery
addArgument, addArgument, addArgument, addArgumentValue, addArgumentValues, addCall, addStatement, bindAllParameters, cacheStatement, cascadeAllParts, cascadeByMapping, cascadePrivateParts, dontBindAllParameters, dontCacheStatement, dontCascadeParts, dontMaintainCache, getCall, getCalls, getDatasourceCall, getDatasourceCalls, getEJBQLString, getFlushOnExecute, getHintString, getJPQLString, getName, getQueryTimeout, getRedirector, getSelectionCriteria, getSessionName, getSQLStatement, getSQLString, getSQLStrings, getTranslatedSQLString, getTranslatedSQLStrings, hasSessionName, ignoreBindAllParameters, ignoreCacheStatement, isCallQuery, isDataModifyQuery, isDataReadQuery, isDeleteAllQuery, isDeleteObjectQuery, isDirectReadQuery, isExpressionQuery, isInsertObjectQuery, isModifyAllQuery, isModifyQuery, isNativeConnectionRequired, isObjectLevelModifyQuery, isReadObjectQuery, isSQLCallQuery, isUpdateAllQuery, isUpdateObjectQuery, isValueReadQuery, isWriteObjectQuery, maintainCache, prepareCall, setCall, setDatasourceCall, setFlushOnExecute, setHintString, setIsNativeConnectionRequired, setJPQLString, setName, setQueryTimeout, setRedirector, setSessionName, setShouldBindAllParameters, setShouldCacheStatement, setShouldMaintainCache, setShouldPrepare, setShouldUseWrapperPolicy, setSQLStatement, setSQLString, shouldBindAllParameters, shouldCacheStatement, shouldCascadeAllParts, shouldCascadeByMapping, shouldCascadeParts, shouldCascadePrivateParts, shouldIgnoreBindAllParameters, shouldIgnoreCacheStatement, shouldMaintainCache, shouldPrepare, shouldUseWrapperPolicy
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ShouldReturnSingleResult

public static final int ShouldReturnSingleResult
Description copied from class: ReportQuery
Simplifies the result by only returning the first result.

See Also:
Constant Field Values

ShouldReturnSingleValue

public static final int ShouldReturnSingleValue
Description copied from class: ReportQuery
Simplifies the result by only returning one value.

See Also:
Constant Field Values

ShouldReturnSingleAttribute

public static final int ShouldReturnSingleAttribute
Description copied from class: ReportQuery
Simplifies the result by only returning the single attribute(as opposed to wrapping in a ReportQueryResult).

See Also:
Constant Field Values

ShouldReturnWithoutReportQueryResult

public static final int ShouldReturnWithoutReportQueryResult
Description copied from class: ReportQuery
For EJB 3 support returns results without using the ReportQueryResult

See Also:
Constant Field Values

FULL_PRIMARY_KEY

public static final int FULL_PRIMARY_KEY
Description copied from class: ReportQuery
Specifies whether to retreive primary keys, first primary key, or no primary key.

See Also:
Constant Field Values

FIRST_PRIMARY_KEY

public static final int FIRST_PRIMARY_KEY
See Also:
Constant Field Values

NO_PRIMARY_KEY

public static final int NO_PRIMARY_KEY
See Also:
Constant Field Values
Constructor Detail

ReportQuery

public ReportQuery(java.lang.Class javaClass,
                   Expression expression)

ReportQuery

public ReportQuery(java.lang.Class javaClass,
                   ExpressionBuilder builder)
The report query is require to be constructor with an expression builder. This build must be used for the selection critiera, any item expressions, group bys and order bys.


ReportQuery

public ReportQuery(ExpressionBuilder builder)
The report query is require to be constructor with an expression builder. This build must be used for the selection critiera, any item expressions, group bys and order bys.

Method Detail

addAttribute

public void addAttribute(java.lang.String itemName)
Add the attribute from the reference class to be included in the result. EXAMPLE: reportQuery.addAttribute("firstName");


addAttribute

public void addAttribute(java.lang.String itemName,
                         Expression attributeExpression)
Add the attribute to be included in the result. EXAMPLE: reportQuery.addAttribute("city", expBuilder.get("address").get("city"));


addAttribute

public void addAttribute(java.lang.String itemName,
                         Expression attributeExpression,
                         java.lang.Class type)
Add the attribute to be included in the result. Return the result as the provided class EXAMPLE: reportQuery.addAttribute("city", expBuilder.get("period").get("startTime"), Time.class);


addAverage

public void addAverage(java.lang.String itemName)
Add the average value of the attribute to be included in the result. Aggregation functions can be used with a group by, or on the entire result set. EXAMPLE: reportQuery.addAverage("salary");


addAverage

public 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. Aggregation functions can be used with a group by, or on the entire result set. EXAMPLE: reportQuery.addAverage("salary", Float.class);


addAverage

public void addAverage(java.lang.String itemName,
                       Expression attributeExpression)
Add the average value of the attribute to be included in the result. Aggregation functions can be used with a group by, or on the entire result set. EXAMPLE: reportQuery.addAverage("managerSalary", expBuilder.get("manager").get("salary"));


addAverage

public 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. Aggregation functions can be used with a group by, or on the entire result set. EXAMPLE: reportQuery.addAverage("managerSalary", expBuilder.get("manager").get("salary"), Double.class);


addConstructorReportItem

public void addConstructorReportItem(ConstructorReportItem item)
Add a ConstructorReportItem to this query's set of return values.

Parameters:
ConstructorReportItem - - used to specify a class constructor and values to pass in from this query
See Also:
ConstructorReportItem

addCount

public void addCount()
Include the number of rows returned by the query in the result. Aggregation functions can be used with a group by, or on the entire result set. EXAMPLE: Java: reportQuery.addCount(); SQL: SELECT COUNT (*) FROM ...

See Also:
addCount(java.lang.String)

addCount

public void addCount(java.lang.String attributeName)
Include the number of rows returned by the query in the result, where attributeExpression is not null. Aggregation functions can be used with a group by, or on the entire result set.

Example:

TopLink: reportQuery.addCount("id"); SQL: SELECT COUNT (t0.EMP_ID) FROM EMPLOYEE t0, ...

Parameters:
attributeName - the number of rows where attributeName is not null will be returned.
See Also:
addCount(java.lang.String, oracle.toplink.expressions.Expression)

addCount

public 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. Aggregation functions can be used with a group by, or on the entire result set. Set the count to be returned as the specified resultType.

Example:

TopLink: reportQuery.addCount("id", Long.class); SQL: SELECT COUNT (t0.EMP_ID) FROM EMPLOYEE t0, ...

Parameters:
attributeName - the number of rows where attributeName is not null will be returned.
See Also:
addCount(java.lang.String, oracle.toplink.expressions.Expression)

addCount

public 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. Aggregation functions can be used with a group by, or on the entire result set.

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.

See Also:
addCount()

addCount

public 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. Aggregation functions can be used with a group by, or on the entire result set. Set the count to be returned as the specified 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.

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.

See Also:
addCount()

addFunctionItem

public 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. Aggregation functions can be used with a group by, or on the entire result set. Example: reportQuery.addFunctionItem("average", expBuilder.get("salary"), "average");


addGrouping

public void addGrouping(java.lang.String attributeName)
Add the attribute to the group by expressions. This will group the result set on that attribute and is normally used in conjunction with aggregation functions. Example: reportQuery.addGrouping("lastName")


addGrouping

public void addGrouping(Expression expression)
Add the attribute expression to the group by expressions. This will group the result set on that attribute and is normally used in conjunction with aggregation functions. Example: reportQuery.addGrouping(expBuilder.get("address").get("country"))


setHavingExpression

public void setHavingExpression(Expression expression)
Add the expression to the query to be used in the HAVING clause. This epression will be used to filter the result sets after they are grouped. It must be used in conjunction with the GROUP BY clause.

Example:

reportQuery.setHavingExpression(expBuilder.get("address").get("country").equal("Canada"))


addItem

public void addItem(java.lang.String itemName,
                    Expression attributeExpression)
ADVANCED: Add the expression value to be included in the result. EXAMPLE: reportQuery.addItem("name", expBuilder.get("firstName").toUpperCase());


addItem

public void addItem(java.lang.String itemName,
                    Expression attributeExpression,
                    java.util.List joinedExpressions)
ADVANCED: Add the expression value to be included in the result. EXAMPLE: reportQuery.addItem("name", expBuilder.get("firstName").toUpperCase());


addMaximum

public void addMaximum(java.lang.String itemName)
Add the maximum value of the attribute to be included in the result. Aggregation functions can be used with a group by, or on the entire result set. EXAMPLE: reportQuery.addMaximum("salary");


addMaximum

public void addMaximum(java.lang.String itemName,
                       Expression attributeExpression)
Add the maximum value of the attribute to be included in the result. Aggregation functions can be used with a group by, or on the entire result set. EXAMPLE: reportQuery.addMaximum("managerSalary", expBuilder.get("manager").get("salary"));


addMinimum

public void addMinimum(java.lang.String itemName)
Add the minimum value of the attribute to be included in the result. Aggregation functions can be used with a group by, or on the entire result set. EXAMPLE: reportQuery.addMinimum("salary");


addMinimum

public void addMinimum(java.lang.String itemName,
                       Expression attributeExpression)
Add the minimum value of the attribute to be included in the result. Aggregation functions can be used with a group by, or on the entire result set. EXAMPLE: reportQuery.addMinimum("managerSalary", expBuilder.get("manager").get("salary"));


addStandardDeviation

public void addStandardDeviation(java.lang.String itemName)
Add the standard deviation value of the attribute to be included in the result. Aggregation functions can be used with a group by, or on the entire result set. EXAMPLE: reportQuery.addStandardDeviation("salary");


addStandardDeviation

public void addStandardDeviation(java.lang.String itemName,
                                 Expression attributeExpression)
Add the standard deviation value of the attribute to be included in the result. Aggregation functions can be used with a group by, or on the entire result set. EXAMPLE: reportQuery.addStandardDeviation("managerSalary", expBuilder.get("manager").get("salary"));


addSum

public void addSum(java.lang.String itemName)
Add the sum value of the attribute to be included in the result. Aggregation functions can be used with a group by, or on the entire result set. EXAMPLE: reportQuery.addSum("salary");


addSum

public 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. Aggregation functions can be used with a group by, or on the entire result set. EXAMPLE: reportQuery.addSum("salary", Float.class);


addSum

public void addSum(java.lang.String itemName,
                   Expression attributeExpression)
Add the sum value of the attribute to be included in the result. Aggregation functions can be used with a group by, or on the entire result set. EXAMPLE: reportQuery.addSum("managerSalary", expBuilder.get("manager").get("salary"));


addSum

public 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. Aggregation functions can be used with a group by, or on the entire result set. EXAMPLE: reportQuery.addSum("managerSalary", expBuilder.get("manager").get("salary"), Float.class);


addVariance

public void addVariance(java.lang.String itemName)
Add the variance value of the attribute to be included in the result. Aggregation functions can be used with a group by, or on the entire result set. EXAMPLE: reportQuery.addVariance("salary");


addVariance

public void addVariance(java.lang.String itemName,
                        Expression attributeExpression)
Add the variance value of the attribute to be included in the result. Aggregation functions can be used with a group by, or on the entire result set. EXAMPLE: reportQuery.addVariance("managerSalary", expBuilder.get("manager").get("salary"));


beginAddingConstructorArguments

public ConstructorReportItem beginAddingConstructorArguments(java.lang.Class constructorClass)
Call a constructor for the given class with the results of this query.

Parameters:
constructorClass -

beginAddingConstructorArguments

public ConstructorReportItem beginAddingConstructorArguments(java.lang.Class constructorClass,
                                                             java.lang.Class[] constructorArgTypes)
Call a constructor for the given class with the results of this query.

Parameters:
constructorClass -
constructorArgTypes - - sets the argument types to be passed to the constructor.

dontRetrievePrimaryKeys

public void dontRetrievePrimaryKeys()
Set if the query results should contain the primary keys or each associated object. This make retrieving the real object easier. By default they are not retrieved.


dontReturnSingleAttribute

public void dontReturnSingleAttribute()
Don't simplify the result by returning the single attribute. Wrap in a ReportQueryResult.


dontReturnSingleResult

public void dontReturnSingleResult()
Simplifies the result by only returning the first result. This can be used if it known that only one row is returned by the report query.


dontReturnSingleValue

public void dontReturnSingleValue()
Simplifies the result by only returning a single value. This can be used if it known that only one row is returned by the report query and only a single item is added to the report.


dontReturnWithoutReportQueryResult

public void dontReturnWithoutReportQueryResult()
Simplifies the result by only returning a single value. This can be used if it known that only one row is returned by the report query and only a single item is added to the report.


endAddingToConstructorItem

public 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.

Throws:
DatabaseException - - an error has occurred on the database

isReportQuery

public boolean isReportQuery()
Return if this is a report query.

Overrides:
isReportQuery in class DatabaseQuery

retrievePrimaryKeys

public void retrievePrimaryKeys()
Set if the query results should contain the primary keys or each associated object. This make retrieving the real object easier. By default they are not retrieved.


returnSingleAttribute

public void returnSingleAttribute()
Simplify the result by returning a single attribute. Don't wrap in a ReportQueryResult.


returnSingleResult

public void returnSingleResult()
Simplifies the result by only returning the first result. This can be used if it known that only one row is returned by the report query.


returnSingleValue

public void returnSingleValue()
Simplifies the result by only returning a single value. This can be used if it known that only one row is returned by the report query and only a single item is added to the report.


returnWithoutReportQueryResult

public void returnWithoutReportQueryResult()
Simplifies the result by only returning a single value. This can be used if it known that only one row is returned by the report query and only a single item is added to the report.


setShouldRetrievePrimaryKeys

public void setShouldRetrievePrimaryKeys(boolean shouldRetrievePrimaryKeys)
Set if the query results should contain the primary keys or each associated object. This make retrieving the real object easier. By default they are not retrieved.


setShouldRetrieveFirstPrimaryKey

public void setShouldRetrieveFirstPrimaryKey(boolean shouldRetrieveFirstPrimaryKey)
ADVANCED: Sets if the query results should contain the first primary key of each associated object. Usefull if this is an EXISTS subquery and you don't care what fields are returned so long as it is a single field. The default value is false. This should only be used with a subquery.


setShouldReturnSingleAttribute

public void setShouldReturnSingleAttribute(boolean newChoice)
Simplifies the result by only returning the attribute (as opposed to wrapping in a ReportQueryResult). This can be used if it is known that only one attribute is returned by the report query.


setShouldReturnSingleResult

public void setShouldReturnSingleResult(boolean newChoice)
Simplifies the result by only returning the first result. This can be used if it known that only one row is returned by the report query.


setShouldReturnSingleValue

public void setShouldReturnSingleValue(boolean newChoice)
Simplifies the result by only returning a single value. This can be used if it known that only one row is returned by the report query and only a single item is added to the report.


setShouldReturnWithoutReportQueryResult

public void setShouldReturnWithoutReportQueryResult(boolean newChoice)
Simplifies the result by returning a nested list instead of the ReportQueryResult. This is used by EJB 3.


shouldRetrievePrimaryKeys

public boolean shouldRetrievePrimaryKeys()
Return if the query results should contain the primary keys or each associated object. This make retrieving the real object easier.


shouldRetrieveFirstPrimaryKey

public boolean shouldRetrieveFirstPrimaryKey()
Return if the query results should contain the first primary key of each associated object. Usefull if this is an EXISTS subquery and you don't care what fields are returned so long as it is a single field.


shouldReturnSingleAttribute

public boolean shouldReturnSingleAttribute()
Answer if we are only returning the attribute (as opposed to wrapping in a ReportQueryResult). This can be used if it is known that only one attribute is returned by the report query.


shouldReturnSingleResult

public boolean shouldReturnSingleResult()
Simplifies the result by only returning the first result. This can be used if it known that only one row is returned by the report query.


shouldReturnSingleValue

public boolean shouldReturnSingleValue()
Simplifies the result by only returning a single value. This can be used if it known that only one row is returned by the report query and only a single item is added to the report.


shouldReturnWithoutReportQueryResult

public boolean shouldReturnWithoutReportQueryResult()
Simplifies the result by returning a nested list instead of the ReportQueryResult. This is used by EJB 3.


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