File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes stateful session bean client servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "stateful session bean client servlet" Watch "stateful session bean client servlet" New topic

stateful session bean client servlet

sai rama krishna
Ranch Hand

Joined: May 29, 2009
Posts: 408

In stateful session bean client servlet we are explicitly setting shoppingCart to session attribute. I do not remember doing similar step withStatelessSession bean.

I do have have annotation as well
ShoppingCart shoppingCart

Please advice
Claude Moore
Ranch Hand

Joined: Jun 24, 2005
Posts: 723

It's simply a nonsense saving a stateless session bean reference in a servlet session, since, as the name implies, SLSB are stateless and thus they don't keep a conversational
state with a specific client.

I hardly used a SFSB myself - I prefer to use SLSB - but I think that you should write something like the following code:

Moreover, using

would inject in your servlet a single reference to ShoppingCart EJB, and it will not work in case of SFSB.

Hope this helps.

I agree. Here's the link:
subject: stateful session bean client servlet
It's not a secret anymore!