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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Stateless Session Beans

Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

I have this small little confusion regarding stateless session bean. Will the ejbCreate() method be called in sequel to the server creating an instance and then calling setSessionContext() or is it when the client calls create method (Just like stateful beans)...

Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Here is your answer:

user calls create() on Stateless session bean home ->
-> new EJBObject gets created
This is the only part which happens when user calls create().

Container actually maintains a pool of stateless sessin beans. How many beans it will create totally depends on container and it do not depend on the clients create method.

But if container decides to create one than only the following steps occure :-

-> new SessionContext gets created
-> new Bean Object gets created
-> setSessionContext() gets called (it comes before ejbCreate ())
-> ejbCreate () gets called.

hope you understand what I explained.
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi srini..better change your name according to the naming policy.
you can view the policy here
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The creation of stateless session beans is not tied to client.

It is the container that decides when to create a stateless session beans.
when the container wants to create a stateless session bean, it runs the bean's constructor,setSessionContext() follwoed by ejbCreate() method.

When the client calls create() on home interface,the container just create a new EJBObject and associate that EJBObject with an instance picked from the pool.

Hope my answer clear your doubt.
Listen. That's my theme music. That's how I know I'm a super hero. That, and this tiny ad told me:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic