File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes help 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 "help " Watch "help " New topic
Author

help

Jingyi Wang
Greenhorn

Joined: Jul 30, 2003
Posts: 25
On P291, the problem #3,

Which are ways in which a client can get reference to an existing entity object's local component interface?
One option is:
D. Receive the reference as a parameter in a method call.
which is one of the correct answer. I don't even understand what's meaning of this statement. Anybody can explain to me?
Thanks
alzamabar
Ranch Hand

Joined: Jul 24, 2002
Posts: 379
Originally posted by Jingyi Wang:
On P291, the problem #3,

Which are ways in which a client can get reference to an existing entity object's local component interface?
One option is:
D. Receive the reference as a parameter in a method call.
which is one of the correct answer. I don't even understand what's meaning of this statement. Anybody can explain to me?
Thanks



You use beans through the home and component interfaces. There are several reasons for that, reasons that I'm not going to list here. The concept it that EJB are reusable components that find a reason to be in a distributed environment (the client/server thing). As you may recall from RMI (which I remember to you is the underlying technology for EJB) a client that wants to invoke methods on a server (and as a server we're talking here of a remote component, doesn't matter if it's on the same machine) cannot simply get a reference to the server object. A client invokes methods on a remote object (server) via a stub to it (the rmic thing - Stubs and Skeletons, remember?). This is to hide the complexity of managing the details of low-lever networking communication. The client has got an object reference to the remote server, thus thinking of having a reference to the remote object. It's the stub that knows how to communicate with the 'thing that represents the server on the server side' (the skeleton thing, or whatever implementation does the skeletonish thing). Now, let's suppose that a local client has got a reference to an EJBLocalObject stub (which means it can invoke methods on what she thinks is the bean). The client can pass this reference to another client, which can use it to use exactly the same bean...functionalities (here we should distinguish between stateful and stateless session beans and entity beans). The only limit that the EJB specs put when passing argument or receiving return types are that the types must be serializable, reference to other resources, references to the bean's special JNDI environment OR...BEAN'S HOME OR COMPONENT INTERFACES (Local or Remote). Bottom line...A reference to a bean's EJBObject or EJBLocalObject can be passed as argument. This will save clients the duty to start all over from getting the bean's home interface stub and from there to obtain an EJBObject (or local) reference stub.

Hope this helps,

Marco


Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD
Lionel Orellana
Ranch Hand

Joined: Mar 19, 2004
Posts: 87
D. Receive the reference as a parameter in a method call.
which is one of the correct answer. I don't even understand what's meaning of this statement


It only means you can have a method in your bean where one of the parameters is the component interface of another bean.

public void methodInMyBean(SomeOtherBean sob){
...
sob.doSomeWorkForMeThankYou();
...
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help