setFirstResult() and Limit Failing in Ejb3.1

118 Views Asked by At

I have 10000 records in database i want to fetch 100 record first time next 100 record 2nd time and so on. I'm using setFirstResult() and maxResult(). I'm maintaining a counter to update set first result offset setFirstResult(count) is always started from first index whatever value you put inside it, it start from 0.

List<StudentBo> bos=manager.createNamedQuery("getAllApplicantForRegistration")
                   .setParameter("batch",dto.getBatch())
                   .setFirstResult(count)
                   .setMaxResult(lastIndex).getResultList();
1

There are 1 best solutions below

0
On

setFirstResult will incease every time while setMaxResult will be static.