Skip Headers

Oracle TopLink Developer's Guide 10g Release 3 (10.1.3) B13593-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# Handling Query Results

TopLink queries generally return Java objects as their result set. TopLink queries can return any of the following:

- Entire objects, with all attributes populated and the object reflected in the cache.

- Collections of objects (see "Collection Query Results").

- Partial objects, with only the attributes you specify populated and without the object reflected in the cache (see "Report Query Results").

- Streams of objects (see "Stream and Cursor Query Results").

- EJB (see "EJB Finders").

## Collection Query Results

A collection is a group of Java objects contained by an instance of `Collection` or `Map`

By default, queries that return more than one object return their results in a `Vector`.

You can configure TopLink to return query results in any concrete instance of `Collection` or `Map`.

Collection results are supported by all TopLink query types.

For information and examples on how to configure and handle collection query results, see "Handling Collection Query Results".

## Report Query Results

A `ReportQuery` (a type of partial object query) returns summary data for selected objects using the database reporting functions and features supported by your platform. Although the report query returns data (not objects), it does enable you to query the returned data and specify it at the object level.

By default, a `ReportQuery` returns a collection (see "Collection Query Results") of `ReportQueryResult` objects, one collection per database row returned. You can use the `ReportQuery` API to configure how a `ReportQuery` returns its results. For more information see "Handling Report Query Results".

For more information, see the following:

- "Report Query"

- "Handling Report Query Results"

- "Partial Object Queries".

## Stream and Cursor Query Results

A stream is a view of a collection, which can be a file, a device, or a `Vector`. A stream provides access to the collection, one element at a time in sequence. This makes it possible to implement stream classes in which the stream does not contain all the objects of a collection at the same time.

Large result sets can be resource-intensive to collect and process. To improve performance and give the client more control over the returned results, configure TopLink queries to use a cursor or stream.

Cursors & streams are supported by all subclasses of `DataReadQuery` and `ReadAllQuery`.

For more information, see "Handling Cursor and Stream Query Results".