tags:

views:

80

answers:

1

Hi there,

atm I'm fetchin a small amount of data (round a bout 100 records) as list and let displaytag render a table for this data. Now I'm facing a problem: I'm in need to show more results at once. If the query results in a size of > 5000 objects everything slows extremly down.

I was wondering if there are any best-practices to recieve such big collections and forward them to the view layer?

+1  A: 

This article explains paging results: http://www.javalobby.org/java/forums/t63849.html

Basically you will get results a handful at a time (you decide how much). After you get those results you go back for more when you want them using hibernates query.setFirstResult(startingIndex) and query.setMaxResults(howMuch).

I also did something in java that probably isn't a great solution but it works. I have my controller method that does the hibernate work pass back a SwingWorker that executes some code to load the data. This way it happens in the background and the UI is loading normally.

Paging seems to be the best solution though.

Arthur Thomas