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

Confusion on EJB Life Cycle HFEJB Pg 94, 100

 
Chander Puri
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HFEJB on Pg 94 has a picture that shows Step 5 where the call to create() method is shown in steps : The services kick in and the bean is created followed by EJBObject is made.

But on Pg 100, in the Architectural Overview :Creating a Stateful Session Bean, the process is shown reversed. It shows that first the EJBObject is created for the bean and then the bean is instantiated.

Which one is the correct one to be followed or there is something which I have misread/misinterpreted.
 
Dan T
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that the container creates the EJBObject before the bean. As you will see in the later chapters, EJBObect is always created before the bean. (For stateful session beans)

Look at page 179, 192 of HF-EJB
 
alzamabar
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chander Puri:
HFEJB on Pg 94 has a picture that shows Step 5 where the call to create() method is shown in steps : The services kick in and the bean is created followed by EJBObject is made.

But on Pg 100, in the Architectural Overview :Creating a Stateful Session Bean, the process is shown reversed. It shows that first the EJBObject is created for the bean and then the bean is instantiated.

Which one is the correct one to be followed or there is something which I have misread/misinterpreted.



I think the order doesn't really matters, unless until the container gives the bean the beanness. Here it matters, because depending on the different moments in the bean lifecycle, the bean class can perform some operation rather than others.

The important moment is when the Container invokes setSessionContext() and ejbCreate(), linking bean instance, EJBObject and SessionContext together.

Marco
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic