Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

stateless session bean's ejbCreate method

 
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) ??
--------------------------------------------------------------------------------
 
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.
 
Hey! You're stepping on my hand! Help me tiny ad!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic