Hi,
I have a problem that is hard to explain, so the vague subject. I am not even sure if this is the right forum (if not, please move as appropriate.) So please bear with me with the explanation.
Approach 1. I have a
servlet that, when called upon, creates a new bean (let's call it bean A for later reference) and saves the bean in the session. This bean A will 1) use DAO to get and save records and 2) handle logic.
JSP will use the session saved bean A for it's display.
All is well.
Approach 2. Then I read about the pagination discussions/faq/articles on the ranch and thought maybe what I did was wasteful (in terms of database access). I have a small set of records, less than 500 for sure, mostly around 100. I thought, maybe using the greedy approach, I can keep all the records in the bean A, instead of fetching the data each time. I only need to find the right slice when doing the pagination.
But by doing this, any update to the database will not affect what the clients see, unless he quits the session.
I think this is a very common problem.
I can, of course, go back to approach 1 and return limited records based on page. But I am very curious what are the techniques or
patterns people use to handle approach 2.
Thanks,
Ben
[ November 07, 2008: Message edited by: Ben Zhang ]