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
What is stateless session bean?
What is enterprise bean?
What is bean-managed persistence?
can anyone explain me the workflow of EJB.I have developed an app. in WSAD using an example that contains CMP and session bean.But i am not able to understand the basic flow between diffrent packages.
Define Initial Context?
Name the acid properties of a transaction.
What is session bean in ejb?
The ejb container implements the ejbhome and ejbobject classes. For every request from a unique client, does the container create a separate instance of the generated ejbhome and ejbobject classes?
How does ejb work in java?
Are entity beans allowed to create() methods?
What is difference between stateless and stateful?
What is stateful or stateless?
Define ejb Create() and EjbPostCreate()?
Mention the three levels for applying interceptor methods.
Define SessionContext ?