-
1. Re: paginating a datamodel
melampo Dec 27, 2006 3:04 AM (in response to ask4saif)Hi.
I have been looking for that some days ago, and I found the jenia4faces library.
With the DataTools family components you can do theses things (I haven't try it at this momment, but with other jenia components I have no problems with seam, so I suposse that it will work).
http://www.jenia.org -
2. Re: paginating a datamodel
ask4saif Dec 27, 2006 8:41 AM (in response to ask4saif)Thanks alot man, I tried it and it worked fine. thanx again....
But there is a little performace issue, I am using DataModel and i loads whole of the data in it from the DataBase. Now this data can be up to thousands of records. Now this raises the memory issue, the server may ran out of memory. how can i solve this issue.
I mean it would be better if it get, suppose 100 records and populate it in the datamodel and on the jsf page it shows 10 records at a time. when we reach the 11th page then it fetches the next 100 records.
Is it possible?
Thanx again man for the reference and everything. -
3. Re: paginating a datamodel
hstang Dec 27, 2006 9:44 AM (in response to ask4saif)The Query API may help.
http://java.sun.com/javaee/5/docs/api/javax/persistence/Query.htmlQuery setFirstResult(int startPosition) Set the position of the first result to retrieve. Query setMaxResults(int maxResult) Set the maximum number of results to retrieve.
-
4. Re: paginating a datamodel
norman.richards Dec 27, 2006 10:54 AM (in response to ask4saif)Look at EntityQuery in the Seam application framework. You can get a paginated query perfect for populating a datatable in just a few minutes.
-
5. Re: paginating a datamodel
ask4saif Dec 28, 2006 1:42 AM (in response to ask4saif)First of all thank you for your support, its very nice of you,
The scenario on which I am working is, I want pagination which i have been able to do with the jenia's library. And i want grid facility in it, which is provided by the seam by using the @DataModel and @DataModelSelection.
Now the only problem which I see in what i did is, the memory. Now my DataModel fetches the full resultset from the db which might get up to 1 million records. In this case how can i efficiently use my DataModel to fetch only chunks of records not full list.
the pagination of google search is great I wonder how can we do that in seam using the datamodel.
any advice which you can give, I will be gratefull
thank you in advance -
6. Re: paginating a datamodel
ask4saif Dec 28, 2006 4:44 AM (in response to ask4saif)Dear Norman Richards,
can you plz send me a sample code for the EntityQuery, or any hint. other than EntityQuery :) thanx -
7. Re: paginating a datamodel
shane.bryzak Dec 28, 2006 6:53 AM (in response to ask4saif)Take a look at the booking example, in particular HotelSearchingAction.