PATH Documentation > WebObjects

Up Previous Next

Setting a Fetch Limit

Synopsis

Describes how to limit the number of rows that are fetched in one query.

Description

By default, when you fetch enterprise objects from a database, all objects that match the fetch criteria are returned. For large databases with lots of records, this can mean that users have to wait while all objects are fetched. To avoid this, you can limit the number of objects fetched.

Setting a Fetch Limit with EOModeler

You can set a fetch limit using the fetch specification builder in EOModeler:

Expand the entity containing the fetch specification you wish to limit.

  1. Select the fetch specification.
  2. Click on the Options tab.
  3. Specify the fetch limit.
  4. Save your model.

Setting a Fetch Limit Programmatically

The EOFetchSpecification property fetchLimit and promptsAfterFetchLimit control the fetch limit behavior. To set the fetch limit you use the setFetchLimit method as shown in the following Java code.

 
EOFetchSpecification fs = new EOFetchSpecification("Movie",null,null); 
setFetchLimit(20); 
movieArray = this.session().defaultEditingContext(). 
    objectsWithFetchSpecification(fs);

See Also

Questions

Keywords

Revision History

4 May, 1998. Kelly Toshach. First Draft.

5 May, 1998. Greg Wilson. Added Synopsis, Questions, and Keywords.

19 March, 1999. Clif Liu. Rewrote second section.


© 1999 Apple Computer, Inc.

Up Previous Next