Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stateful Session Bean Usage

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I have a simple question about stateful session EJBs. Since stateful session beans does not have a findByPrimaryKey method, I assume that we have to hold the reference to the remote interface somewhere in the session. Here is my implementation, could you please verify it's validity?
I use a servlet to connect to the home interface and do a create, store the remote interface pointer in the session when I get back. So whenever I need to reference that stateful session bean, the pointer will be retrieved by from the session, and call the bean. After I finish using the bean, I will just do a removeAttribute from the session object to remove that pointer; since there are no more reference to that remote interface, I assumed that the EJB container will do the garbage collection on its own.
Is this implementation correct? OR do I have to explicitly call the ejbRemove after I finish with the stateful session bean to notify the container for a remove operation?
Thank you very much.
Hubert
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic