File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes HFE - EJBObject!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "HFE - EJBObject!!!" Watch "HFE - EJBObject!!!" New topic

HFE - EJBObject!!!

Brian Smith
Ranch Hand

Joined: Oct 26, 2002
Posts: 232
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?
Vladas Razas
Ranch Hand

Joined: Dec 02, 2003
Posts: 385
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
Ken Krebs
Ranch Hand

Joined: Nov 27, 2002
Posts: 451
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
I agree. Here's the link:
subject: HFE - EJBObject!!!
It's not a secret anymore!