[javaee-spec users] Re: Scope of Query Results

From: Bill Shannon <>
Date: Tue, 23 Jul 2013 12:54:38 -0700

Apparently I can't say this enough times...


The correct name is "Java EE".

Thanks. :-)

I'm sure others with more experience can suggest the best way to handle this,
but one approach would be to cache a few pages worth of results and to
asynchronously populate (and purge) the cache as the user pages through the
pages. It probably depends a lot on the size of the data and the time
required to fetch the result set. If the underlying data can change while
you're viewing it, the multiple fetches of the result set might make it more
complicated. wrote on 07/23/13 08:28:
> We have a simple (and common) use case which doesn't seem to be handled
> well by JEE. I'm trying to find out if I'm missing something in JEE
> or if this could/should be an enhancement to the JEE spec.
> The use case is the following. We have a web application which allows
> our customers to run ad-hoc queries (which may take a few minutes to
> run) against data in our database and then browse through the results
> page by page in a web browser. The result set may contain tens of
> thousands or even hundreds of thousands of rows. My understanding of
> the JEE architecture is that the result set should/will be closed at
> the end of the http/servlet request. This presents a major hurdle for
> us since we must either re-run the query (which may take a few minutes)
> every time the user requests another page of data or else cache a lot
> of data (in memory as well as to disk, which may also go against the
> JEE spec).
> I would imagine that querying for and browsing through a large result
> set is a rather common use case. Is there a proper way to handle this
> scenario that I am not aware of? Or, should an enhancement be made to
> the JEE spec to provide an extended scope (similar to a view or session
> scope) so a database connection and result set can remain open until
> the scope terminates?