Certification
SCBCDSCBCD Study Notes : Chapter 7 : CMP Entity Bean Life Cycle (Part 1)
Please find the Study Notes and resources which covers the 1st Part of Chapter 7 : CMP Entity Bean Life Cycle, as part of the Sun Certified Business Component Developer exam CX-310-090.
Chapter 7. CMP Entity Bean Life Cycle
Identify correct and incorrect statements or examples about the life cycle of a CMP entity bean.
An entity bean instance is in one of the following THREE states:
1. DOES NOT EXIST state.
2. POOLED state. An instance in the pooled state is not associated with any particular entity object identity.
3. READY state. An instance in the ready state is assigned an entity object identity.
The following steps describe the life cycle of an entity bean instance:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
public abstract class AddressBean implements javax.ejb.EntityBean { ;;;;;;;;;;
... ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;// Customer home methods. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;// These are wrappers of ejbSelect methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;public Collection ejbHomeQueryZipCodes(String state) ;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;throws FinderException { ;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;return ejbSelectZipCodes(state); ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;} ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;public Collection ejbHomeQueryAll() ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;throws FinderException { ;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;return ejbSelectAll(); ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;} ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;public CustomerLocal ejbHomeQueryCustomer(AddressLocal addr) ;;;;;;;LLL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;throws FinderException { ;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;return ejbSelectCustomer(addr); ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;} ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
... ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1. Through the ejbCreate< METHOD >(...) and ejbPostCreate< METHOD >(...) methods.
The CONTAINER invokes the ejbCreate< METHOD >(...) and ejbPostCreate< METHOD >(...) methods when the instance is assigned to an entity object during entity object creation (i.e., when the CLIENT invokes a create(...) method on the entity bean’s home object).
2. Through the ejbActivate() method.
The CONTAINER invokes the ejbActivate() method on an instance when an instance needs to be activated to service an invocation on an existing entity object - this occurs because there is no suitable instance in the ready state to service the client’s call.
1. Through the ejbPassivate() method.
The CONTAINER invokes the ejbPassivate() method when the container wants to disassociate the instance from the entity object identity without removing the entity object.
2. Through the ejbRemove() method.
The CONTAINER invokes the ejbRemove() method when the container is removing the entity object (i.e., when the CLIENT invoked the remove() method on the entity object’s component interface or a remove(...) method on the entity bean’s home interface).
3. Because of a transaction rollback for ejbCreate(), ejbPostCreate(), or ejbRemove().
If ejbCreate(), ejbPostCreate(), or ejbRemove() is called and the transaction rolls back, the container will transition the bean instance to the POOLED state.
NOTE:
________________
Author: Mikalai Zaikin. Please Click Here to visit Authors site for any updates and changes to the study notes.