Cayenne User Documentation
SelectQuery Customization

SelectQueries allow to fine tune the behavior of the fetch using the following API:

- public void setFetchLimit(int fetchLimit)
  If set to a value greater than zero, tells Cayenne that query should never retrieve more than X objects (X == fetchLimit) from the database. If a result set contains more rows, they are simply ignored and never read. This is a "safety" feature that can be used to prevent the application from crashing when an unexpectedly high number of records exists for a given query.

- public void setDistinct(boolean distinct)
  If set to true (default is false), tells Cayenne that query should fetch distinct rows.
- public void setFetchingDataRows(boolean flag)
  If set to true (default is false), tells Cayenne that instead of creating DataObjects, it should fetch "data rows" - dictionaries containing database values, using table column names for the keys. "Performance Tuning" chapter explains how data rows can improve performance and how and when to use them.
- public void setPageSize(int pageSize)
  If set to a value greater than zero, tells Cayenne that query should do a "lazy" fetch, breaking result into "pages". Performance Tuning has a detailed discussion of paged queries.

.
Copyright ©2001-2007 Apache Software Foundation