JPA setFirstResult Example
In this section, you will learn how to use setFirstResult method in your jpa application. The setFirstResult(N) method is used to skip the first "N" elements form the result set. Please note that the counting starts from the 0, so if you specify 2 then first 3 records will be skipped.
setFirstResult(int startingPosition): This is the method of Query interface. The setFirstResult method is used to set the position of first result for retrieving the data. It also return same query instance.
For this application you need the following files:
Database Table: student
Model Class: Student.java
Main Class: JPASetFirstResult.java