Shane Duan wrote:
>
> Do you mind explaining some more?  Isn't that what Entity Beans doing,
> avoiding the hits of the database by storing the data in the memory?  I
> would guess the only difference is that you can control the life of the
> data.  But, we can do that with entity bean also, can't we?
>
> Ian McCallion wrote:
>
> > "Padmanabhan.K" wrote:
> > >
> > > I require to cache some client specific data in the
> > > application to avoid frequent database hits.
> > >  <snip>
>
> > A SFSB is probably quite appropriate for your
> > application. It is a very common design pattern
> > that early in the life of a SFSB data is
> > retrieved from a database, during its life the data is
> > updated, and at the end of its life the
> > data is written back to the database (or not,
> > depending on the outcome of the client session).

You are right, but you can only do that with an entity bean if you are prepared
to keep the transaction open for the duration of the user's session. If you
close the transaction part way through, the incomplete and/or unconfirmed
changes that have been made so far will be written to the database.

Keeping the transaction open for the duration of the user session is called the
"long transaction" design point. There have been many warnings on this list and
elsewhere against this because long transactions clog up databases and
application servers by holding onto internal resources such as locks, log
voloumes and in some cases threads. Long transactions are however commonplace in
(simple) client-server applications.

Although there are application design costs for separating the concepts of
session and transaction there are compensating application design benefits. For
example if user session == transaction then an error automatically throws away
all the user's work, which is undesireable in many cases.

Hope this helps.

cheers... Ian


Ian McCallion
Alexis Systems Limited
Romsey, UK

===========================================================================
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".

Reply via email to