The following example shows how to limit the results returned by a query.
It is useful to implement server side pagination.
Refer first example for the configuration and mapping.
Hibernate org.hibernate.Query provides the following APIs,
public Query setFirstResult(int firstResult)
- Set the first row to retrieve. If not set,
rows will be retrieved beginnning from row 0.
public Query setMaxResults(int maxResults)
- Set the maximum number of rows to retrieve. If not set,
there is no limit to the number of rows retrieved.