• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Criteria Paging is not working

 
Charan kumar sarvepalli
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • 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.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Christian Dillinger
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • 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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic