aspose file tools*
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 Spring in Action this week in the Spring 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