Value List Handler
Hi,
I am designing an application that will provide a web service front end to query AS/400 data. The web service will access a stateless session bean that will call a DAO to execute the query on the AS/400.
The queries will be made up of varied search criteria and will be specific to a set of permissions. Some of them could return thousands of rows.
My thoughts on using the ValueListHandler pattern for our scenarios:
Result sets are returned from the database as a result of running a query.
Result sets cannot be cached as they require connections to the database.
In order to cache data returned in manner suggested by pattern, we would have to create an object for each row in result set (potentially thousands), add them to a valuList and cache.
The cached valuelist could only be reused when permissions and search criteria are identical to those used in original search so this data would also have to be stored along side cached value list and checks performed before deciding to use cached data or run a new query.
Alternative suggestion:
Run query each time against database (using native driver between Java app and database so there will not be a large network overhead)
Only create objects for subset required, e.g., 10 - 20. Can use resultSet.absolute(10) to get directly to 10th row in result set.
Only need to process 10 rows at a time, do not need to create objects for thousands of rows (most of which will potentially never be accessed).
Could cache these 10 objects if required but possibly no reason as same query (identical permissions and search criteria) will hardly be entered that frequently in a short time peroid.
The downside to my alternative suggestion is that the Database will be constantly hit with queries but is this not more acceptable than creating thousands of potentially unused objects and maintaining them?
Advice would be greatly appreciated..
Thanks.

