• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Criteria Paging is not working

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am trying a code using Criteria which i have setFirstResults(20) and setMaxResults(50).

I am expecting the hibernate will load 30 records but it is returning 50 records.

The code is like this


size is 50 i.e. hibernate loaded 50 records.

what is wrong in this.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you asked it to skip 20 then return 50 results. Looks like Hibernate is doing what you asked.
Did you try entering 20,30?
 
Charan kumar sarvepalli
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, i tried with 20 and 30. it is returning 30 records.

Hibernate generated query (rowNum < ? and rownum > ?) has '?' place holders so i am unable to trace the values of those.
 
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
firstResult specifies the rownumber of the first result row. maxResults (see the "s") specifies the number of results. so if you want 20 rows you have to set maxResults(20).
reply
    Bookmark Topic Watch Topic
  • New Topic