|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Paging
Marker interface for the code generator to implement paging.
Paging is database specific and therefore the SQL dialect needs to be defined before the query object is created.
The SQL select statement that is used will normally have anorder by
clause.
public interface PagedQueries extends BaseQuery, Paging { @Query(sql = "select id {%%.id}, name {%%.name} from person order by name") List<Person> listPersons() throws SQLException; ... } // use Oracle QueryObjectFactory.setSQLDialect(new OracleDialect()); // create a query object PagedQueries queries = QueryObjectFactory.createQueryObject(PagedQueries.class); // set the database connection queries.setConnection(connection); // set the first row number/offset (zero-based) queries.setFirstResult(10); // set the maximum number of results queries.setMaxResults(20); // run the query List<Person> personList = queries.listPersons(); // personList will contain the records 11 to 31 from the result set
QueryObjectFactory.setSQLDialect(sf.qof.dialect.SQLDialect)
,
SQLDialect
Method Summary | |
---|---|
Paging |
setFirstResult(int firstResult)
Defines the first row of the result set to be returned. |
Paging |
setMaxResults(int maxResults)
Defines the maximum number of rows that should be returned. |
Method Detail |
---|
Paging setFirstResult(int firstResult)
firstResult
- the zero based index of the first result row
Paging setMaxResults(int maxResults)
maxResults
- maximum number of rows
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |