Explain Stateful session bean life cycle?
Answer Posted / hari
Life Cycle of a Stateful Session Bean
While in the ready stage, the EJB container may decide to deactivate, or passivate, the bean by moving it from memory to secondary storage. (Typically, the EJB container uses a least-recently-used algorithm to select a bean for passivation.) The EJB container invokes the bean's ejbPassivate method immediately before passivating it. If a client invokes a business method on the bean while it is in the passive stage, the EJB container activates the bean, moving it back to the ready stage, and then calls the bean's ejbActivate method.
At the end of the life cycle, the client invokes the remove method and the EJB container calls the bean's ejbRemove method. The bean's instance is ready for garbage collection.
Your code controls the invocation of only two life-cycle methods--the create and remove methods in the client. All other methods in are invoked by the EJB container. The ejbCreate method, for example, is inside the bean class, allowing you to perform certain operations right after the bean is instantiated. For instance, you may wish to connect to a database in the ejbCreate method.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Write the basic requirement of a cmp entity based class in 2.0 from ejb 1.1?
What are the components of ejb?
Explain the architectural relationship between JavaBeans and JTA?
Where is ejb used?
Is ejbCreate() method mandatory while defining a Session Bean?
What is the purpose of ejb in java?
What does @singleton annotation do?
What is stateless authentication?
Is ejb a framework?
For ejb applications with bean-managed transaction demarcations, which of the following is used by the client to get a reference to the usertransaction object for the weblogic server domain?
Differentiate Phantom from Un-repeatable?
Define EAR, WAR and JAR ?
Who took over ejb?
What’s new in the ejb 2.0 specification?
What do you mean by re-entrant? Can you say that session beans as re-entrant? Can entity beans be specified as re-entrant?