| 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
|
 |
 |
|
|
subject: Get the records by portion from a database
|
|
|