This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
hi folks, in page 88, it's explained that Container writes a class that implements the Component interface we write. why does the container have to write a class that implements our Component? is the Component itself not engough? thanks.
Container writes classes for Home and Remote/Local interfaces. Because... they are only interfaces. Look at their signatures: public interface AdviceHome extends EJBHome It's interface! You cannot create object from interface it's abstract. There is the reason you don't implement it. The implementation is container specific. Every vendor may implement them differently as long as they conform to EJB specs. And do you really want to implement those methods yourself: getHomeHandle, getEJBMetaData...? I don't think so
Namaste, The purpose of that is to allow the container to interleave its services by providing an EJBObject to act as a proxy for the actual component. This proxy intercepts the calls to your component to handle these services, typically the security or transaction handling or other services you have declared in the deployment descriptor. That is the point of EJB, to separate configuration of these low level services from the component's Java code and to be able to attach these services at runtime to your EJB component. You can never call the component directly in your client code, you must go through the EJBObject proxy.
kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg