Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

HFE - EJBObject!!!

 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Look! It's Leonardo da Vinci! And he brought a tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic