This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes share stateful session bean among stateless session beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "share stateful session bean among stateless session beans" Watch "share stateful session bean among stateless session beans" New topic
Author

share stateful session bean among stateless session beans

Marco Dalla Torre
Greenhorn

Joined: Apr 21, 2011
Posts: 1
Hi all,

I am quite new to EJB so please bear with me :-) I am trying to write an ejb web application that has multiple stateless session beans thah share a stateful session. The latter provides methods tha use data read from database. That is, the SLSBs inject the SFSB and use it in their methods. The intended reason is to share the same information and code, instead of having multiple DB lookup points for each SLSB. In some cases I also directly use the stateful session bean from presentation tier.
Now this does not work since the SFSB injected is a different instance for each SLSB, and this causes trouble when its data gets modified, and its state is not shared to other SLSBs. So my question is: is it possible to share an SFSB instance among multiple SLSBs? Is it a crazy idea (this thread seems to suggest so)? And in that case what would be a better solution?

Thank you,
Marco
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: share stateful session bean among stateless session beans
 
Similar Threads
Why pool stateless session beans when you can get by with one instance?
How a Statefull Session Bean is tied to the Client
how stateless session beans handles the clients?
shopping cart for FBN
Session Facade implementation