Skip Headers

# Report Query

Previous

Next

If you want to summarize (or roll up) certain attributes of a set of objects, you can use a `ReportQuery`.

A `ReportQuery` returns summary data from a set of objects and their related objects. That is, it returns data about objects, rather than the objects themselves. However, it still lets you query and specify the data at the object level. To build a report query, you specify the search criteria, the data you require about the objects, and how that data should be summarized.

For example, you can create a report query to compute the average age of all employees in your company. The report query is not interested in the specific objects (the employees), but rather, summary information about them (their average age).

A `ReportQuery` lets you do the following:

- Specify a subset of the object's attributes and its related object's attributes, which allows you to query for lightweight information.

- Build complex object-level expressions for the selection criteria and ordering criteria.

- Use data source aggregation functions (supported by your platform), such as `SUM`, `MIN`, `MAX`, `AVG`, and `COUNT`.

- Use expressions to group data.

- Request primary key attributes with each `ReportQueryResult`. This makes it easy to request the real object from a lightweight result.

A `ReportQuery` is the most efficient form of partial object query (see "Partial Object Queries") because it takes advantage of the reporting capabilities of your data source (if available). Oracle recommends that you use `ReportQuery` to do partial object queries.

The `ReportQuery` API returns a collection of `ReportQueryResult` objects, similar in structure and behavior to a `DatabaseRow` or a `Map`. For more information, see "Report Query Results".

For more information, see the following:

- "Reading Case 1: Displaying Names in a List"

- "Reading Objects Using Report Queries"

- "Configuring Named Queries at the Descriptor Level"