Les Hartzman wrote:
> I'm new to EJBs and the concepts of both session and entity beans. As
> such, I'm particularly interested in trying to clarify the use of
> entity beans.
>
> As I understand it, entity beans are used primarily to represent data
> in a database. Now, it I've got 4 GB of data in a database with 70
> tables and 1-many relationships in some cases, how would I use entity
> beans to cache data in the database to reduce DB access?
EJBs are not really for the purpose of caching. Some EJB servers give you the
option of caching, but typically they instruct you to turn this option off if
you are clustering your EJB servers or if the database is being updated from
other sources.
> So if I've got a central table in the DB representing the core
> entities of the DB, do you cache the entire table
No - for the reasons outlined.
> and then instantiate
> as needed entity beans that represent the related data coming off of
> the cached table/beans?
Yes, except be careful of making your entity beans too granular which can create
tis own performance problem. It's possible by using BMP to instantiate the
related data into the EJBs representing the core entities.
> I'm trying to determine if EJBs are the way to go for helping to serve
> up dynamic content on a web site where the content is in the DB.
Most database systems do a good job of caching table rows (though not the
objects formed by the application from the rows of course), so one very good
approach to the problem is to ensure that the mapping between row and object is
efficient and to load all data from the database as needed.
My recommendation would be to use EJBs if the business logic of the application
is complex enough to need them - probably only if your application is updating
the database online.
Ian McCallion
CICS Business Unit
IBM Hursley
[EMAIL PROTECTED]
Tel: ++44-1962-818065
Fax: ++44-1962-818069
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".