Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

stateless session bean's ejbCreate method  RSS feed

 
Frank Sikuluzu
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For stateless session beans' ejbCreate method, we can use SessionContext to access EJB Object. But I don't know why ? stateless session beans are created separately from any client invocation. So when ejbCreate is called, there can be no client yet, and EJB Object is only created when a client calls "create" on the Home interface to let container create a EJB Object. So, when "ejbCreate" is called how can you know which EJB Object the bean is associated with (there can be no EJB Object yet) ??
--------------------------------------------------------------------------------
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stateless and stateful session beans have different lifecycles. As you noticed, since stateless session beans are instantiated by the container, without any invocation from a client, you can't do much in ejbCreate.

I haven't heard of any real need to create session beans that are state-agnostic, so I assume that you just have to pick one that meets your requirements and implement it, documenting the fact that it is indeed a stateful or stateless session bean and hoping the application assembler sticks to it.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!