users@javaee-spec.java.net

[javaee-spec users] Scope of Query Results

From: <shoyt_at_ipsww.com>
Date: Tue, 23 Jul 2013 15:28:27 +0000 (UTC)

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?