6. Guidelines for Implementation of BMP EJBs (1) Once data is found, the primary keys for that data are sent back to the container. The container will then create EJB objects and associate bean instances with the objects. These methods (also known as Finder methods) will locate the existing entity bean data instances from within the persistent storage. For instance ejbFindByPrimaryKey() , ejbFindAll() and others. ejbFind<…>(<…>) This is used to access the context and to acquire the environment information. The context has to be in a member variable. This method is called when the container has to increase the pool size by instantiating a new entity bean. setEntityContext() Implementation Explanation Method
7. Guidelines for Implementation of BMP EJBs (2) Once the bean instance is associated with the EJB Object, the ejbPostCreate() is called. Every ejbCreate() is followed by an ejbPostCreate() . ejbPostCreate(<…>) ejbPostCreate() The parameters have to be initialized and this initialization has to be valid. Database representations have to be created explicitly. This method is responsible for creating new data in the database. It also initializes the bean. ejbCreate(<…>) Implementation Explanation Method
8. Guidelines for Implementation of BMP EJBs (3) The data in the database is explicitly updated through a storage API. This method is called to update the database data with the new values from the in‑memory fields. ejbStore() The getPrimaryKey() method has to be called. This will tell the bean what data has to be loaded. This method is called to load data into the database. ejbLoad() For this method, socket connections are important. This is because the bean has to service particular clients. When the container has to take a bean from the pool and then change it to a ready state, the ejbActivate() method is called. ejbActivate() Implementation Explanation Method
9. Guidelines for Implementation of BMP EJBs (4) All resources have to be released. Resources could be socket connections allocated during ejbActivate() . The container calls this method to return the bean to the pool. ejbPassivate() All resources allocated during the setEntityContext() have to be released. It is called just before the entity bean instance is destroyed. This method dissociates the bean from its environment. unsetEntityContext() The getPrimaryKey() is used to destroy the data from the database. This will destroy the data in the database. ejbRemove() Implementation Explanation Method
10. An Object Model Example of BMP java.rmi.Remote java.ejb.EJBLocalObject javax.ejb.EJBLocalHome javax.ejb.EJBHome java.ejb.EJBObject Local Home Interface Home Interface Remote Interface Local Interface Home Object EJB Object EJB Local Object Local Home Object Supplied by bean provider Comes with EJB distribution Comes with Java2 Platform
11. Remote Interface (1) java.io.serializable javax.ejb.EntityBean Bean Abstract Class Primary Key Class javax.ejb.EnterpriseBean Comes with Java2 Platform Comes with EJB distribution Supplied by bean provider