• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ejbobject/bean instance

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am novice to EJB. I got confused with some naming conventions can anyone please clear these

Q) Is EJBObject and RemoteInterface object one and the same?? or Is EJBObject same as bean instance.??

This seems to be very silly but please clear this.

Thanks in advance!
 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Shanthi Priya:
Hi,
I am novice to EJB. I got confused with some naming conventions can anyone please clear these

Q) Is EJBObject and RemoteInterface object one and the same?? or Is EJBObject same as bean instance.??

This seems to be very silly but please clear this.

Thanks in advance!



EJBObject is a remote class (because extends the EJBObject interface, which in turn extends java.rmi.Remote) that is written by the container and that steps in the middle between the client and the bean instance. The bean functionalities are exposed to the client through the bean's component interface, which the EJBObject implements. To the client, the EJBObject (or better, the EJBObject stub) *is* the bean. A remote client get a reference (stub) to the EJBObject and invokes methods on the stub (which also implements the bean's component interface), thinking it's invoking methods directly on the bean instance. The reason is mainly that the bean instance mustn't be a '*remote* object, in other words a client shouldn't be able to invoke directly methods on it (because it could miss the Container services - which is what it's all about), but each business method invocation should pass through the EJBObject (which in the HF book is called the 'bean' bodyguard);

The bean developer (i.e. You), must write the bean class (ensuring that it implements all the methods defined in the component interface, but you should avoid, although technically possible from implementing the component interface), the home and the component interface; the container writes the EJBHome, EJBObject, EJBHome_stub, EJBObject_stub objects, which are the 'interface' the client sees and can work with.

There is then a difference between the bean instance (as a simple object) and the 'fully qualified bean', which is the bean instance once the container has assigned a context to it and invoked the ejbCreate() method (for session beans), or when simply a context has been assigned to it (in case of entity beans). An ordinary java object (let's say the bean class when only the constructor has been invoked), can't do all the things a bean can, but you will learn it along the way.
 
reply
    Bookmark Topic Watch Topic
  • New Topic