struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <>
Subject Re: Struts DB Access :: Best Practices
Date Thu, 10 Mar 2005 19:17:28 GMT
I've actually handled this in a previous project by writing a class that
implements the ResultSet interface (well, *some* of it anyway). 
Internally the data gets stored as an ArrayList of HashMaps, so it's
completely disconnected, and it's a drop-in replacement any place we would
have used a ResultSet.

As someone else said, memory utilization is the down-side to this
approach, but if you have suitable hardware and know your resultset size
won't kill you, this a great approach.

We have actually found though that using it doesn't kill us memory-wise,
and we do sometimes have some resultsets come back that I would consider
large... but more importantly the application is considerably more
efficient and responsive than using regular ResultSets precisely because
connections and statements and such aren't being held open, so no waiting
for a connection from the pool as much, etc.

Hopefully we're going to start using a REAL persistance package around
here soon (I'm doing some evaluation now), but until that day, we've found
this to be an excellent solution in many situations.

Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies

On Thu, March 10, 2005 2:03 pm, Larry Meadors said:
> On Thu, 10 Mar 2005 12:56:04 -0600, Scott Lamb <> wrote:
>> NetSQL wrote:
>> > Even silly JSF uses RowSet as DTO. (RowSet is realy a ArrayList of
>> > HashMaps. Rows of Columns)
>> What does a ArrayList of HashMaps get you over a java.sql.ResultSet?
> The major disadvantage of using the RS directly is that it keeps the
> connection (and associated resources - statements, etc) open the
> entire time you have it. In a high load / limited resources
> application, this is a big deal, and why tools like iBATIS and
> Hibernate take this approach.
> RAM and CPU are way cheaper than more Oracle licenses. ;-)
>> I'll tell you a big disadvantage: it keeps everything in memory. What if
>> the result set is large?
> That is why we do the row handlers in ibatis - you get one row at a
> time with very little added weight over the result set. We also
> support a paginated list that only keeps a limited number of rows in
> memory.
> Larry
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message