Win a flower (🌹) or copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java (📚) this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
master stewards:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
garden masters:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
gardeners:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

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

 
pioneer
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
pioneer
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any complex EJB sample application that uses more than one stateful EJB will do.

Thanks.
 
I have always wanted to have a neighbor just like you - Fred Rogers. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!