Describe the life cycle of an entity bean.
Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.
Describe the life cycle of an entity bean.
Rating:
The life cycle of an entity bean is as shown in the following image:

An entity bean can have three states during its life as follows:
- Does not exist
- Pooled
- Method ready
An entity instance moves to the method ready state when the container calls the ejbCreate<method>() and ejbPostCreate<method>() methods, or the ejbActivate() method. In the method ready state, a bean instance represents a specific entity.
The container can invoke the ejbLoad() and ejbStore() methods whenever required. An ejbStore() method can be invoked from a business method, the ejbLoad() method, or the ejbStore() method.
The container may also call ejbPassivate() at any time to move the instance back into the pool. During passivation, resources should be released and reacquired upon activation.
An instance will be moved back to the pool if a transaction rollback occurs during the ejbCreate<method>() or ejbPostCreate<method>() operations. It can also move to the pool when the container calls the ejbRemove() method.
An instance is removed from the pool and goes to the does not exist state immediately after the container calls the unsetEntityContext() method.
Rating:
Was this information helpful?
Other articles
- What is the <prim-key-class> element of the deployment descriptor?
- What is the use of the session bean's remote home interface?
- What is the == operator?
- What are message-driven beans?
- What are the uses of writing the remote component interface?
