Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFE - EJBObject!!!

 
Brian Smith
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Vladas Razas
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic