This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes callback and lifecycle methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "callback and lifecycle methods" Watch "callback and lifecycle methods" New topic

callback and lifecycle methods

Sainudheen Mydeen
Ranch Hand

Joined: Aug 18, 2003
Posts: 218
Are callback and lifecycle methods of EJB different?
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

I would say YES.

Sainudheen Mydeen
Ranch Hand

Joined: Aug 18, 2003
Posts: 218
Can somebody explain or show me a link where I can get more details about the differences?
Sivasundaram Umapathy
Ranch Hand

Joined: Aug 10, 2002
Posts: 360
Lifecycle methods generally use the callback mechanism to pass control and data to the bean.

Co-Author - SCMAD Exam Guide - ISBN:9780070077881
Author - Java certification success, Part 4: SCEA
Sainudheen Mydeen
Ranch Hand

Joined: Aug 18, 2003
Posts: 218
I read ejbActivate, ejbPassivate, setEntityContext etc are known as callback methods. Are they not life-cycle methods? OR they are so called based on the context?
Kathy Sierra
Cowgirl and Author
Ranch Hand

Joined: Oct 10, 2002
Posts: 1572
Lifecycle methods are indeed Container callbacks. Basically, anything that's not a business method from the component interface is considered a Container callback. That means anything with "ejb" in front of the name. But you won't need to care about this distinction in terminology for the exam. As long as you know the circumstances under which methods are called on the bean class, you will be fine. The key things are to understand the differences between the behavior of lifecycle methods such as ejbCreate() and ejbRemove() on all of the different bean types. Or things like... which ones are invoked as a direct result of a client invocation. For example, ejbRemove() is called on a stateFUL session bean or entity bean as a direct result of a client call to remove(), but on a stateLESS session bean, the ejbRemove() Container callback is NOT called as a result of a client invocation (but rather because the Container just decided it was time to start killing some beans to shrink the pool size... and when the client calls remove() on a stateLESS bean, the Container just laughs and says, "Do you think I CARE?"
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
It cleared.
Lifecycle methods are indeed Container callbacks

Java Developer, Thailand
I agree. Here's the link:
subject: callback and lifecycle methods
Similar Threads
Can't callbacks throw checked exceptions?
Calling init or destroy.
Entity callback doubt
stateful session bean
Many @PostConstruct methods?