I assume you mean to cache the EJBs in the user's servlet session, so you will have several remote EJBs in there depending on how many different actions the user has accessed.
It sounds like you need to do this to allow transaction management across a group of data operations?
I would not do it by caching the EJBs at all, or having stateful session beans. I would keep my actionformbean in the user's servlet session instead, accumulating the data over several http requests and then marshall the whole collection of data across to the EJB session in one.
Struts is good at that. I expect you'd give yourself more headaches than it's worth, trying to collect the user's session data in the EJB layer.
It sounds like you are writing a web interface for an already existing client-server app.
On 03/02/2004 03:42 PM Smith, Darrin wrote:
Thanks for the reply!
That is kind of what is going on already. The Action's act as the local Java class talked about in the Business Delegate Pattern that create and cache the Stateful Session Bean (a different one per Action). They (the Actions) then use the Session Bean's business logic. This is done in a standard way though where each Session Bean will implement an interface that is common to all of the other Session Beans in the application. This way each action simply calls a factory and based on the way the factory is called, a Stateful Session Bean for that type of action is returned, then cached in the Action. All actions then can make the submit(...), inspect(...), etc. calls common to all types of Session Beans (but performed differently by each one).
The question is though, for these actions, shouldn't they keep session state that will match the Stateful Session Beans? Typically, I know you want have your Model hold Session state while your client holds request state, but in this case, where the Action needs to remember the cached Session Bean, doesn't it seem to make sense to mark the Action as session scope in the struts config file as well?
-----Original Message----- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Monday, March 01, 2004 5:35 PM To: Struts Users Mailing List Subject: Re: Semi-OT: Saving state when using EJB Session Beans and Struts
On 03/01/2004 05:47 PM Smith, Darrin wrote:
In short, the Actions will be calling various Stateful Session Beans to do the actual work. These are used for various reasons with the main one
being
their built-in transaction support (online orders...need to be either
done...or not done). How should state be handled and at what level
(page...request...session...) in the upstream struts portion?
Hmmm. Thought someone more knowledgeable would answer this, and was waiting with interest myself. Oh well. Without too much experience with EJBs myself, I can say a couple of things: the gurus say 'use the business delegate pattern with an EJB session facade'. Secondly, it depends heavily on what your stateful session beans are holding as state. Care to name something?
Adam
-- struts 1.1 + tomcat 5.0.16 + java 1.4.2 Linux 2.4.20 Debian
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]