Which of the following methods should be used by a session bean to clean up the resources that it has acquired before its removal?
1)ejbRemove
2)passivate
3)remove
4) setRollbackOnly
5) ejbPassivate
the correct answers are 1 and 5.
Is answer 3 is wrong because there is no such Remove method is present. But remove method is present in home interface for
EJB 2.1. Only @Remove annotation is present. But again here we are talking about EJb 2.1 so remove method is present. Removing the bean also ensures that the resources are released.
But if you look at the explanation for the answer-
"
An ejb acquires resources in @PostCreate and @PostActivate() methods and it releases the same resources in @Remove and @PrePassivate methods.
If a bean is passivated and if the timeout occurs, the container does not call @Remove method.
"
So again what is the differnce between ejbRemove and remove method in home interface for EJB 2 methods?