This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ejbobject/bean instance

 
Shanthi Priya
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • 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!
 
alzamabar
Ranch Hand
Posts: 379
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic