Originally posted by B Sathish:
Why do we need a handle to a stateless session bean.
Its simply a mechanism to bypass having to go through JNDI and the Home interface again. It lets you conceivably greate the handle on one machine, transmit it to another machine which can then re-stablish the connection to the components without doing the whole JDNI/Home song and dance.
Originally posted by B Sathish:
Why would anyone want to call remove on a stateless session bean.
Its simply a matter of keeping the interface of both types of session beans consistent.
Also remember (in reference to both of your questions) that when the client has a reference to a stateless session bean, there is no way for the client to tell whether its dealing with a stateless session bean. A session bean is made stateless/stateful through the deployment descriptor. A create with arguments in the home interface is a dead giveaway that you are dealing with a stateful sessionbean.
However you could add client specific state to a (formerly) stateless session bean and reploy it as a stateful session bean without the client ever knowing.