• 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

How criteria working for Criteria.setMaxResults(10)

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using criteria, for pagination. The application get slow as for every page it brings all the records although (through display tag) only 10 records displayed.
when I used Criteria.setMaxResults(10), it brings only 10 records, I want to know is Hibernated firing query to bring only 10 records from database.
I am not able to see in any thing related with that in generated HQL.

Thanks
Raj
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you add the following to your hibernate.cfg.xml file, you should be able to see the sql being generated:




This will also provide more debug information and variables being used for the insertion in your code. This is a log4j setting for Hibernate:



Let us know what you see!

-Cameron McKenzie
 
Rajan Nath
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Cameron,
I am using the show_sql . The query generated I am able to find out but the query is not contains any thing due to which only 10 records fetched.
Can any body send how exactly the sample query will generate by using setMaxResult
 
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic