Pagination - hibernate with JSF table using ObjectListDataProvider
Hello All,
How we can use the JSF table component & pagination option avilable in JSC for records pagination using ObjectListDataProvider? Let say I have 100 recorsd and I want to do pagination of them of Page Size = 5 (total pages 20), then how to proceed?
We have the hibernate working with JSC, and now I am looking for this advanced implementation using JSC & Hibernate.
Surya
--Thoughts can bring change
[448 byte] By [
Surya_IND] at [2007-11-26 9:50:41]

# 1
Surya,
I don't think I am understanding your question. Let's take the application built by following the steps in the Hibernate tutorial at http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/hib ernate.html.
If you use the Options tab on the Table Layout dialog to set pagination at a page size of 3 rows, and you run the project, you will see the table page through the data.
Can you explain more about what you are looking for?
# 2
Hi,
Thanks for you reaply.
Ok, let me explain the scrnario in detail....
1) I have 100 records in database, and i wnat to do the pagination of them using hibernate.
2) I dont want to fetch 100 records in one shot, rather I want that only 5 records should be feteched per request (I want to do server side pagination)
3) when i send the request to server for very first time I am able to see the records according to configured page size(i.e. 5).
4) When i am cliking next button I am not able to see nect 5 recorsd rather the same records are displayed again.
I hope now I am able to draw a clear picture in front of you, let me know if i am missing something or you and any suggestion.
Thanks in advance.
Surya
# 4
I have a problem with pagination and hibernate and I want to take a ride on your question: when the page is loaded I load all data from database. Then I have a filter I made that retrieves some of the data and reloads the table, and that works fine. But when I hit the next page button, the table goes to second page, but without the filter, i.e, with all data again.
I think it has someting to do with the place where I do the initial load, with full data. I've put this code in _init:
private void _init() throws Exception {
try {
Integer empresaId = new Integer(this.getSessionBean1().getCodEmpresaLog());
getSessionBean1().getTituloReceberDataProvider().atualizaListaTitulos(empresaId);
} catch(Exception ex) {
log("Erro para pegar empresas : ", ex);
error("Erro para pegar empresas : " + ex.getMessage());
}
}
And to filter, I use this method, called by a button:
getSessionBean1().getTituloReceberDataProvider().filtraListaTitulos(empresaId, sCodCliente, sSituacao, dataDe, dataA);
This method repopulates the dataset and it works, but when I change pages it loads full data again. Someone has some light to shed on this?
Thanks in advance!