I was going to say something along those lines as well.

Create a class that represents a row in your table.
Create an associated class that has knowledge of how to persist the data to the table i.e. CRUD methods.
Populate the data's primary key (Or keys) and read it with a passed database connection.


i.e

TableRow tableRow = new TableRow(new TableRowPersister());
tableRow.setKey(1);
tableRow.read(conn);

Then you could do this via a Struts Plugin for all of the data you require to cache.

If you Make TableRow extend a class that handles cahcing i.e. reads simply return the last copy of the data but all the other methods effect the table then you have what I think you need. The O'reilly book on Java Database Best Practices talks about it.

I have a feeling that there is some framework that may do all that I have described. I would be interested to know if there is.



----Original Message Follows----
From: Vic <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Re: data caching in web application
Date: Tue, 30 Nov 2004 03:01:51 -0800

A more MVC approach is to do DATA chacing in the DATA layer.
It is recomended that you do datacaching via a DAO. (iBatis, Hibrenate, etc.)
.V




Jesse Alexander (KBSA 21) wrote:
concerning the actual access, that Javaworld article about sql in Java sounds a cool way to do it...

about the initializing:
- create a standard servlet that fetches the data and sets up a JavaBean
(aka POJO) and stores that in the servlet-context
- define this servlet in the web.xml and add the "load-on-startup" parameter. Then the container will load it automatically for you
and only afterwards your webapp will be enabled


hope this helps
Alexander

-----Original Message-----
From: Ashish Kulkarni [mailto:[EMAIL PROTECTED] Sent: Monday, November 29, 2004 9:54 PM
To: [EMAIL PROTECTED]
Subject: data caching in web application


Hi
I have a table in DB2 on AS400 which has about 10000
records, i want to cache this data to improve my web
application performance, I dont want to cache it in session,
I was thinking of loading the data in array or some
class and load it in servlet context, what is the best way to do it?
is there some better way so i can querry this cached
data using keys as if using primary key in SQL
statment
Ashish




__________________________________ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to