• Post Reply Bookmark Topic Watch Topic
  • New Topic

call-back methods in entity beans  RSS feed

 
Aaron Raja
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what are the call-back methods in entity beans? can you give me example also if you can please?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a read of the JavaDocs for Entity Beans. Everywhere the method comment starts with "A container invokes this method..." is a callback method.
 
Aaron Raja
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul
 
Aaron Raja
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what i got from docs is
EJB interacts with its container through the following mechanisms
1) EJBContext
2) JNDI
3) Call-back Methods

Regarding Call-back Methods -->
Every EJB implements an interface (extends EnterpriseBean) which define several methods which alert the bean to various events in its lifecycle. A container is responsible for invoking these methods. These methods notify the bean when it is about to be activated, to be persisted to the database, to end a transaction, to remove the bean from the memory, etc. For example the entity bean has the following call-back methods:

public interface javax.ejb.EntityBean {
public void setEntityContext(javax.ejb.EntityContext c);
public void unsetEntityContext();
public void ejbLoad();
public void ejbStore();
public void ejbActivate();
public void ejbPassivate();
public void ejbRemove();
}

Thanks again for giving me the lead!!!
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!