Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Get the records by portion from a database

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I don't want to load all the database table records in the memory while visulizing it on the screen. On the creen the user can scroll over the records, and only 10 records are displayed at a time. Currently, When the user requires the Next 10 records to be displayed, I have to iterate through the whole list (The whole list is always in memory). I dont'want to load the whole list in memory (Very big list); I want to keep only a part of it (1000 records), when the user requires the Next 10 records to be displayed, If this Next 10 records are not available in the list in memory, that time I will have to refresh my List in memory by the Next 1000 records from the database.

This is my question, Does Hibernate allow to load a part of the records of a database table. How can I do that ?

Thanks !
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ya using setFirstResult and setMaxResults methods..
like this
Query q = session.createQuery("...");
q.setFirstResult(start);
q.setMaxResults(length);

For detail info, check this link
http://www.javalobby.org/java/forums/t63849.html
reply
    Bookmark Topic Watch Topic
  • New Topic