Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

share stateful session bean among stateless session beans

 
Marco Dalla Torre
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic