It's not a secret anymore!
The moose likes Object Relational Mapping and the fly likes Get the records by portion from a database Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Get the records by portion from a database" Watch "Get the records by portion from a database" New topic
Author

Get the records by portion from a database

Mohamed Amri
Greenhorn

Joined: Feb 17, 2006
Posts: 11
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 !
Madan Prabhu Durai
Greenhorn

Joined: Nov 11, 2008
Posts: 3
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Get the records by portion from a database
 
Similar Threads
Handling millions of rows without using arrays
Pagination using the database(DB2)
JTable problem.
how to use href links to call next search results page without instantiating objects again and again
Hibernate performance issues using huge databases