This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Servlets and the fly likes Maintaning Query result between navigations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Maintaning Query result between navigations" Watch "Maintaning Query result between navigations" New topic

Maintaning Query result between navigations

Frederik Ericsson
Ranch Hand

Joined: Apr 27, 2005
Posts: 128
Hi All,

there is one functionality in our project like, selecting set of customers based upon some criteria like date of purchase, dept, so and so...

Let us say in the first page get the dates, second page get the amount it will go upto next 4 pages , we ran the query with all the parametes from all the 6 pages and get the result to the last page. its taking long time to run it, because it really a big query with joins n very large table as well.

Now whar we are planning is when we get the date in the first page run the query and get the result, get the next parameter and run the query against the previous result with the current parameter and proceed furthur upto the last result page.

My question is

How can I store the result after running the query in each page, how to keep maintain for geting another parameter and run it ?

Its kind of confusing I know, but i would like to do it in this way..

Please do help me..

Sachin Joshi
Ranch Hand

Joined: Aug 06, 2008
Posts: 83

Not clear with your question so I am going to ask few .....

1. Is this a web application?
2. How much data are you thinking of storing? (Few pages means 1kb per page or so?)

3. How many users are going to use it?

In general if you are thinking of storing the data in memory you are basically looking for a caching technique.
A simple caching can be implemented using Hashtable if you already have a unique id available for each page and data.... not sure this is what you are looking for....

Web Development Tips and Tutorials - By Sachin
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
How can I store the result after running the query in each page, how to keep maintain for geting another parameter and run it ?

Sounds like a job for a custom object which holds both the query and the result.

Be sure you don't hang on to any of the JDBC result objects, they have to be properly disposed of.

I agree. Here's the link:
subject: Maintaning Query result between navigations
It's not a secret anymore!