Hibernate range query - dividing result in group
===

I have 3 records in table. I wanted results in different groups. So i have done range query as,

    Query q=session.createQuery("select a.firstName,a.lastname from Emp);
    q.setFirstResult(startVal);
    q.setMaxResults(endVal);
    myList = q.list();
    System.out.println(myList.size());

I have created group as below.These groups generated dynamically.
    
    startVal    endval
    0           1
    2           2
    3           3
   
for startVal= 0  , endVal = 1  its working  (returning myList.size() value 1)  
for startVal= 2 ,  endVal = 2  its working  (returning myList.size() value 1)  

But for startVal= 3 , endVal = 3  ITS NOT WORKING returning myList.size() value 0.

Can anybody help me in this ?