Title: Running Queries

Running Queries

Cayenne Query API is discussed in the following chapters. This chapter concentrates on how to execute an existing query via a DataContext. Still we'd like to point to a few aspects of the query API here, as they are important for the query execution discussion:

Being an instance of QueryEngine, DataContext has generic API to execute any type of queries, however it is rarely used directly. Instead DataContext provides a number of overriden convenience methods to run the types of queries mentioned above.

Running Query Instances

The following methods are used for running selecting and non-selecting Query objects built in the code:

Running Mapped Queries

The following methods are used to run named selecting and non-selecting queries mapped using CayenneModeler and stored in the DataMap XML file: