Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

callback and lifecycle methods

 
Sainudheen Mydeen
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Are callback and lifecycle methods of EJB different?
-Sainudheen
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would say YES.
 
Sainudheen Mydeen
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can somebody explain or show me a link where I can get more details about the differences?
Thanks
-Sainudheen
 
Sivasundaram Umapathy
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lifecycle methods generally use the callback mechanism to pass control and data to the bean.
 
Sainudheen Mydeen
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
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?
-Sainudheen
 
Kathy Sierra
Cowgirl and Author
Rancher
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?"
cheers,
kathy
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It cleared.
Lifecycle methods are indeed Container callbacks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic