Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.4
  Go To Table Of Contents
 Search
 PDFComments
Comments


jdbc.max-rows

Use eclipselink.jdbc.max-rows to specify the maximum number of rows to be returned. If the query returns more rows than specified, the trailing rows will not be returned.


Values

Table 4-17 describes this query hint's valid values.

Table 4-17 Valid Values for eclipselink.jdbc.max-rows

Value Description

Int or String (that can be parsed to Int values)

Configures the JDBC maximum number of rows.



Usage

This hint is similar to JPQL setMaxResults(), but can be specified within the metadata for NamedQueries.


Examples

Example 4-35 shows how to use this hint in a JPA query.

Example 4-35 Using jdbc.max-rows in a JPA Query

import org.eclipse.persistence.config.HintValues;
 import org.eclipse.persistence.config.QueryHints;
 query.setHint("eclipselink.JDBC_MAX_ROWS", "100");

Example 4-36 shows how to use this hint with the @QueryHint annotation.

Example 4-36 Using jdbc.max-rows in a @QueryHint Annotation

import org.eclipse.persistence.config.HintValues;
 import org.eclipse.persistence.config.QueryHints;
 @QueryHint(name=QueryHints.JDBC_MAX_ROWS, value="100");


See Also

For more information, see: