> Hi, I'm currently making a session bean, which will eventually act as
> a Shopping Basket.
[quoted text clipped - 9 lines]
> The session bean type is set to stateful (and I have tried stateless).
> Can anyone point me in the direction of the problem please?
First, you are probably using the wrong technology for what you're
trying to do. If you want to support a large number of concurrent
baskets then you want to maintain basket state either
(1) At the servlet level, in custom objects (possibly normal JavaBeans)
stored with (HTTP) session scope, or
(2) In a backend database, accessed via a stateless session bean or,
possibly, entity beans.
I would shoot for (1) if you can, as (IMO) EJBs are to be avoided except
where you _need_ their particular strengths (transactionality,
container-managed security, distributability, etc.). Where you need
EJBs, however, embrace them. Also, do not be confused by the name
"session bean" -- the "session" part is completely unrelated to the kind
of client sessions managed by the front end in a typical web application.
If you insist on carrying on with your current design then you may find
that clearing out the basket state in the bean implementation's
ejbRemove() method solves the immediate problem. If not, then, your
client interface is probably using the same session bean instance for
multiple clients (see above comments about sessions).
John Bollinger
jobollin@indiana.edu
Dj Frenzy - 30 Nov 2004 11:42 GMT
Cheers John.
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Session2.html
I found this this tutorial pretty helpful also.