Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

7.7.2 of EJB Spec Creating Session Object

 
Giju George
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The figure 6 shows that, while creating a Session Object, the client invoked the create on EJB(Local)Home and then the "EJB (local)Home calls new on the EJB(local) Object". From what I understood was, the client calls create on EJB(local)Home and then the home calls it on the instance of the bean. So the EJB(local)Object is no where coming in between. I understand that the create "RETURNS" an EJB (local)Object....
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And your question is?

Not sure whether you finally understood the figure or not. Please let us know
 
Giju George
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My ques is, Does EJB(local) Home "CALLS" EJB(local)Object while creating a session Object???. That's what the diagram shows. The Home only "RETURNS" the EJB Object.

Or, am I misunderstanding the OID diagram??
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What the diagram shows is that when a client invokes create on a EJB(Local)Home of a stateful session bean, the home first creates a new EJB(Local)Object, then a new instance of the session bean class on which it sets the context and finally it initializes the newly created session bean by invoking ejbCreate() on it.

This process is described in section 7.6 of the EJB spec which states:

A [stateful] session bean instance�s life starts when a client invokes a create<METHOD>(...) method on the session bean�s home interface. This causes the container to invoke newInstance() on the session bean class to create a new session bean instance. Next, the container calls setSessionContext() and ejbCreate<METHOD>(...) on the instance and returns the session object reference to the client. The instance is now in the method ready state.


Is it more clear? Don't hesitate otherwise
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic