People who have worked extensively on EJB2, might have used EJBHandle. According to EJB specifications, when we use EJB2.1 and get the EJB stub from the EJB home interface, this stub can not be serialized. Hence in case of a stateful session bean, if you want to store the handle to the particular session bean, you can get the handle of the bean and store the handle by serializing it. Later you can de-serialize it and can connect to the same bean and go back to the same state. This was particularly useful in case of "Failover scenarios" or in case of advanced spftwares where we can provide resume later kind of option. So you save the state to your disk, come back later and get hooked to the same state. (Think of accessing one Stateful session bean from servlet and you want to store the handle in the Httpsession to make sure any browser refresh or so can get you back to the same session bean always)
This is being modified in EJB3, EJB 3 actually does not support EJB Handle. It was tough for me to digest this fact for some time till I realized that in case of EJB 3, the proxy object that the container provides when we look up the bean using context or by using "dependency injection", is serializable. So the proxy object that we get from the context can be serialized and later de-serialized to connect to the same Stateful session bean. This eliminates the need to EJBHandle altogether.
No comments:
Post a Comment