• Post Reply Bookmark Topic Watch Topic
  • New Topic

ejb life cycle  RSS feed

 
THUAN VN
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have got a question like this:
1: ejb life cycle comes immediately before ejbCreate method
1: ejb life cycle comes immediately after ejbCreate method
3; ejb life cycle comes immediately before ejbPostCreate method
4: ejb life cycle comes immediately after ejbCreate method
I chose 1 because before calling ejbCreate methos, ejb container have to create a new ejb instance or get existing bean instance from ejb pool, so ejb life cycle comes before ejbCreate method
am I right?
 
Rich Raposa
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was this a question on a Sun exam, for a certification of some sort? If so, than it shows how meaningless these certifications are. I can probably recite the EJB specification from memory, and I really have no idea what the answer to that question is. Why? Because knowing the answer has no effect on my coding, deploying, or using an EJB.
One more reason why I'll never take one of Sun's certification exams again.
 
THUAN VN
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that understanding thing like this is more helpful. Of cource, I can code ejb with no ejb spec but that is not a good way to master ejb
Originally posted by Rich Raposa:
Was this a question on a Sun exam, for a certification of some sort? If so, than it shows how meaningless these certifications are. I can probably recite the EJB specification from memory, and I really have no idea what the answer to that question is. Why? Because knowing the answer has no effect on my coding, deploying, or using an EJB.
One more reason why I'll never take one of Sun's certification exams again.

[ January 19, 2003: Message edited by: THUAN VN ]
 
Roshan Lal
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think, all the choices in this questions are incorrect. The life cycle begins when the container calls newInstance() on the bean. Then container calls setXXXContext() (XXX could be Session or Entity). ejbCreate is called after both the newInstance(), setXXXContext() have been called.

-Roshan
Originally posted by THUAN VN:
Hi
I have got a question like this:
1: ejb life cycle comes immediately before ejbCreate method
1: ejb life cycle comes immediately after ejbCreate method
3; ejb life cycle comes immediately before ejbPostCreate method
4: ejb life cycle comes immediately after ejbCreate method
I chose 1 because before calling ejbCreate methos, ejb container have to create a new ejb instance or get existing bean instance from ejb pool, so ejb life cycle comes before ejbCreate method
am I right?
 
Chetan M
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi roshan,
Like to add on to ur answer.. Container calls newInstance() on the bean when client calls create() through remote interface.. So thats when newInstance() will be called and then as u said
container calls setXXXContext() (XXX could be Session or Entity). & then ejbCreate() is called thats when bean is ready to cater to requests..
..
So ejb life cycle begins when create() in called from client, after which container invokes setxxxContext() and then ejbCreate()....
[ January 27, 2003: Message edited by: Chetan M ]
 
Dhananjay Inamdar
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raposa,
I agree with your comment that while doing the EJB development it is not compulsory/necessary to know all these things.
But I think that if you know all these things then your code will me more efficient from the point of performance. It is totally depends upon your attitde that do u line to know all these things or not? It actually decides that how do you want to grow in a IT industry.
I don't think it is better to comment directly on the certification in this manner.
 
Roshan Lal
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chetan,
Thanks for your input. I think when the client calls create() on home, the life cycle not necessarily begins there because in response to create(), the container may choose not to call a newInstance() rather take the already created bean instances from the pool. For stateful session beans which are not pooled, the create() forces newInstance() on server, there we can say the life cycle begins with create(), not for SLSB and Entity beans.
Just what I understand, might be wrong.
-Roshan
Originally posted by Chetan M:
..
So ejb life cycle begins when create() in called from client, after which container invokes setxxxContext() and then ejbCreate()....
[ January 27, 2003: Message edited by: Chetan M ]

[ January 27, 2003: Message edited by: Roshan Lal ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!