Laird
Stateful session beans can (1) enhance performance and (2) provide a
better model for EJBs that expect to receive multiple method calls whose
outcome is based on the EJB's state.
(1) The client creates, for example a ShoppingCart EJB and then finds
(possibly by indirectly using an entity bean) things to buy, buys some
things and then says I'm willing to pay. If the ShoppingCart is stateful
it will hold the state of the cart for the duration - until the client
calls remove(). That saves having to create (probably from the stateless
session bean pool) each time, map to the context of the shopping cart
state and then remove.
(2) The design of the ShoppingCart is easier.
Tony
----
Laird Nelson wrote:
>
> Are there any real world examples of stateful session beans being used?
> Most of the design patterns I've seen concerning EJBs say to use
> stateless session beans wherever possible. Well, given that the state
> in a stateful session bean must be regarded as totally transient anyhow,
> it seems like it's *always* possible to use stateless session beans
> instead. Are stateful session beans the black sheep of the EJB family?
>
> Also, can someone explain the rationale to me for why a session bean is
> designated as stateless or stateful only in the deployment descriptor?
> Surely there are enough semantic differences between the two that the
> decision to be stateful or stateless does not belong at deployment time!
>
> Cheers,
> Laird
>
> ===========================================================================
> 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".
--
Tony Holderith | Interactive Business Solutions
[EMAIL PROTECTED] | NetCentric Solutions
http://www.interactivebusiness.com | Business Objects
voice: 310.414.6760, 805.893.4503 | fax: 310.414.6759
Don't connect to the Internet - be there. IBS
===========================================================================
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".