You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Daniel Yawitz <da...@yawitz.com> on 2001/04/26 20:53:11 UTC

JSP>Beans>RDB: general app design question

Can anyone give a little wisdom on the best way to approach data
exchange/persistence between a Bean layer and a database?  Specifically,
should the Bean layer "remember" data in between sessions,pageloads,etc, or
should it re-contact the database for every new request?

For example, a simple message board system.  The DB has a single "message"
table.  Should there be a single application-scope Bean that retrieves
initially and holds an object-ized copy of the data from the DB in the JVM?
Each JSP page would get the message board data it needed from the Bean, and
the Bean would only contact the DB when changes needed to be made(new
messages...).

Is this a bad approach, keeping a persistent object representation of DB
data in the JVM?  Else, what is a good alternative approach?  Having no Bean
"memory" and requiring a DB connection for each page request?  Then the Bean
layer is really just for logic separation, i guess.

I'm a newbie, what do I know :)  thanks in advance,
dan