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.
Joined: Mar 28, 2010
Any complex EJB sample application that uses more than one stateful EJB will do.
subject: Help on Using Stateful Session Beans (SFSB) the right way