-
1. Re: @Factory & Pagination
andygibson Dec 14, 2007 10:29 AM (in response to skanky78)Hey Sven,
Well, here's the problem, the factory method needs to know what page you are on, and then return the results for that page.
The first easy option is to use an EntityQuery which has the firstResult and maxResults, next, first, last, previous and a bunch of other properties and methods to let you control the data.
You can roll your own, but then you find yourself writing a bunch of code that is the same as the existing EntityQuery object code.
The problem with the rich:dataScroller is that it works on the whole list at once. The EntityQuery queries the database for the number of rows in the result, and then only fetches the number of rows on a page.
You can set up params in pages.xml to pass from one page to the next the values of the current page so you have a stateless viewer as opposed to keeping all items in memory (or keep reloading them) for the data scroller.
Cheers,
Andy -
2. Re: @Factory & Pagination
igx89 Dec 14, 2007 10:36 AM (in response to skanky78)Note: EntityQuery requires JPA, so if you're just using plain Hibernate (like me) you might be out of luck :(.
-
3. Re: @Factory & Pagination
andygibson Dec 14, 2007 10:41 AM (in response to skanky78)You could roll your own non-JPA entity query which woudl have methods for pagination. It's probably well worth it considering the re-use you can get out of them. Same with EntityHome.
Cheers,
Andy -
4. Re: @Factory & Pagination
supernovasoftware.com Dec 14, 2007 11:27 AM (in response to skanky78)I just posted an example of Ajax paging with Richfaces Datascroller
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4112998#4112998