wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes Help on Using Stateful Session Beans (SFSB) the right way 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 "Help on Using Stateful Session Beans (SFSB) the right way" Watch "Help on Using Stateful Session Beans (SFSB) the right way" New topic
Author

Help on Using Stateful Session Beans (SFSB) the right way

Frankie Fuentes
Ranch Hand

Joined: Mar 28, 2010
Posts: 41
Hi,

I'm trying to shift all business state of my application from HttpSession to SFSB. When the application was still using HttpSession, my classes (session scoped instances) are seperated by the following:



In this case, a project list simply display list of projects. Selecting a project will display project information. A project can have one or more contracts under it. All business actions or methods requires to have a reference to the currently logged in user for permission checks. And because of JSF's simple dependency injection, I am able to inject a session scoped variable named UserSessionBean to say another session scoped variable named ProjectListSessionBean for "Project Information" module.

Now that I started to use stateful session beans, I'm not sure how divide it into parts where I can have more than one SFSB. If I don't do that, creation of single gigantic monolithic SFSB is inevitable. But if I try to divide them, I'm clueless on how should I make them capable of communicating to one another. Perhaps injecting the UserBean SFSB to a ProjectListBean SFSB? I don't know how to do this propertly. (We're not allowed to use Spring)

What I currently have is something like this:



I placed all objects that needs to communicate to one anther in one class and make it an SFSB. For example, in order to create a new project, I must have a reference to the currently logged in user to see if such business action is permissible. Same with the contract information. If I continue on this, my SFBS would become a gigantic monolithic class.

I would like to partition this SFSB to maybe 3 SFSBs: 1) one containing user logged in, 2) another that manages the projects and 3) another that manages the contracts under currently activeProject. I want to partition it without losing a reference to the currently logged in user for "project list" module, and the current active project for "contract list" module.

Much appreciated.

Thanks.

Frankie Fuentes
Ranch Hand

Joined: Mar 28, 2010
Posts: 41
Any complex EJB sample application that uses more than one stateful EJB will do.

Thanks.
 
Consider Paul's rocket mass heater.
 
subject: Help on Using Stateful Session Beans (SFSB) the right way
 
Similar Threads
how to deal with session if you have both servlet and EJB ?
Session management and login
shopping cart for FBN
partII: stateful session bean is necessary to serve as a booking cart?
SFSB behing SLSB session facade?