Paging Large Data Sets With A LazyList

By , 30 April 2007

Paging Large Data Sets With A LazyList

As you might have noticed from reading my previous blogs, I'm a big fan of simple solutions to problems, especially where they reduce the amount of plumbing which needs to be implemented. For some time, my problem has been finding an efficient way to page through large data sets using JPA and JSF UIData components such as <h:dataTable/>.

I had read a lot of difficult ways to solve the problem, and tried using OpenJPA's Large Result Set (LRS) extensions to JPA, but none of these solutions satisfied me in terms of efficiency and simplicity. What I came up with instead, is a basic List implementation which uses the standard JPA API to load the results of a query on-demand.

Read more...

26 comments, post a comment!

EntityManager Per Session Pattern

By , 28 January 2007

A recent webapp I was working on had a fairly simple requirement for a paged table of data from the database. Because of the large amount of data available it couldn't just all be loaded into memory at once, which means a bit more work on the UI side. So rather than write all the plumbing to manage paging and queries I thought I'd give OpenJPA's Large Result Sets (LRS) a try. A LRS is a List which looks and behaves like all the data is already loaded, but is actually fetching it on the fly using database cursors. It all worked wonderfully, except for a few.. erm.. slight problems using the EntityManager-per-session pattern, which is required to keep the LRS open.

Read more...

No comments yet, be the first to comment!

OpenJPA Packaging Tricks

By , 29 December 2006

Figbird 2.0, our content management system, has a fairly unique module system which allows us to package extensions into jar files and simply drop them into WEB-INF/lib to install them. Each jar normally also contains a bunch of entities which need to be added to the default persistence unit when the application is loaded. Unfortunately for us, it seems that although the EJB 3.0 expert group imagined almost every possible scenario for packaging persistence units, there is no way of merging persistence units together.

Read more...

No comments yet, be the first to comment!

< Prev1 2 Next >