Howdy,
I just noticed this in the second example:
The PortableRemoteObject.narrow tells you this is a Remote client view. So that's not a problem. If you do NOT see a narrow(), on the exam, you can say with absolute 100% certainty that you are seeing a LOCAL client view. Even though it is *possible* depending on your vendor, to NOT use a narrow() with a Remote view, that would not be according to the spec, and on the exam, you are to answer ONLY according to the spec.
But that's not the part that bothers me. What bothers me is that this code is this:
Sequence sRemote = (Sequence) sHome.create() ;
There should NEVER need to be a cast of the return from create(). Remember, create() is declared with the correct return type -- the type of the component interface -- so there should NEVER be a cast. Doesn't mean it will hurt you, but it should not be there, and is never needed. The ONLY things that need to be cast are things that are not returned with the correct declared return type. That means JNDI context lookup() and also getEJBObject() or getEJBHome() on the handle objects.
In addition, you need a narrow as well as a cast if those things-declared-without-the-specific-return-type are Remote stubs.
So, things which must be cast:
* result of JNDI lookup
* result of a call to a handle method
Things which must be narrowed:
* result of JNDI lookup if the client view is Remote (which means the thing coming back is a stub)
* ALL calls to a handle (because handles are ONLY for Remote client views)
* Any thing else that might return a stub, unless the method's return type is the Remote interface type.
========================
cheers,
Kathy
