When the client calls remove on the home or component interface to remove the session object, the container issues ejbRemove() on the bean instance.
I think still there is a confusion on this question because what Cheenu mentioned from specs...is the case when the session instance is in ready state and it is no where mentioned on specs, what will happen when a remove call is made while the instance is in the passivated state...
Pavel is correct. The ejbRemove method will be called if the remove method is called by client when a bean is passivated state.
Couple of things you need to consider:
1) When a bean is in passivated state, it has only two exits from that state - timeout or activation. The bean will move to "Does not exist" state only when it is timed out.
2) Considering the bean in passivated state, and the client invoking a method on the bean will bring back to the "Method Ready" state; i.e. ejbActivate() method is called.
3) The client will not be aware whether the bean is passivated or activated state, since it totally depends upon the container.
From the 1st point you can tell that the bean will not directly go to the "does not exist" state, since there is no time out. So the only exit remaining for the bean is to come back to the active state. So when the client calls the remove() methods , the methods will invoked in the following sequence remove() --> ebjActivate()-->ejbRemove
When the world says, "Give up,"<br />Hope whispers, "Try it one more time."
when the client calls remove on a bean that has been in passivated state,the container first invokes ejbActivate to bring back the bean to method ready state then the ejb remove is called on the bean to remove the bean.
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop