Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

what is the exact defination of container callback

Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

Just wanted more clarification on this one. What do we mean when we say container callback methods.
Why is the business method not a container callback method.

Or is it that the EJBObject invokes the bean's business method where as the other methods namely setSessionContext, ejbActivate, ejbPassivate & ejbRemove are called by the container & the EJBObject has no role to play during the same.

In that case why is ejbCreate not a callback method

Can someone ellaborate

Author & Gold Digger
Posts: 7617
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A container callback method is a method that the container needs to invoke on some object for carrying out its work. Usually a callback method is declared in an interface (SessionBean, EntityBean, SessionSynchronization, etc) that classes will implement in order to satisfy a contract with the container in which they will run. In that sense, ejbCreate is also a callback method except that it is not explicitely declared in the *Bean interfaces because the developer may choose to append some custom suffix to its name, as in ejbCreateWithNameAndPlace(String name, String place) for instance.

Usually, everything that goes through the EJBObject comes from the client. Now, a client may invoke some method that will cause the container to invoke a callback on the bean before executing the desired method. For instance, if an entity bean is passivated and the client invokes a method on it, the container will first call ejbActivate() and ejbLoad() on it before serving the request.

Does this make sense?
There's a way to do it better - find it. -Edison. A better tiny ad:
We need your help - Coderanch server fundraiser
    Bookmark Topic Watch Topic
  • New Topic