wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Query related to Narrowing 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 "Query related to Narrowing" Watch "Query related to Narrowing" New topic
Author

Query related to Narrowing

Sagar Shroff
Ranch Hand

Joined: Jun 07, 2011
Posts: 208

The Spec says

When the EJB 2.1 and earlier remote home and remote component interfaces are used, the narrowing of remote types requires the use of javax.rmi.PortableRemoteObject.narrow rather than Java language casts.

Now I have many queries related to this

What i have understood in RMI is that when you do lookup you get a STUB(which takes care of all the n/w complexities) and not an actual implementation.
So when you register your business object eg "abcInstance" ,the container will actually register a stub object which the client will later do lookup ,
( i assume that the container might have followed this procedure to create a STUB )
a) It will first see which business interface this instance is implementing.
b) And then create a stub which has all the method implemented of the interface.

So that means it is not necessary that the STUB and the actual implementation be always SAME ! because the stub is having only those methods which are mentioned in the interface,while the actual
implementation class might have more methods
So now my Question to everyone is that it does not make sense for a client to actually do narrowing.
Because when he does lookup he receives a stub instance which he stores in Business interface reference, so when he narrow's ,he'll narrow down to stub which has same methods which are there in the interface
so does not make sense to actually narrow down.

Can someone put light on this and correct me if i have got wrong somewhere.
My above explanation can be totally wrong if the container creates a STUB base on the actual implementation class rather then the interface.So can someone confirm what actually happens ??

Q2) the above quote of spec has mentioned narrowing information about EJB 2.x.What about EJB 3.x .I dint found it mentioned anywhere ???

Regards,
Shroff.


OCJP-90%,OCPWCD-95%
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1686
    
  25

Hi Sagar,

If you are going to do the EE6 version of the EJB exam: skip all the paragraphs concerning EJB2.x.

Regards,
Frits
Sagar Shroff
Ranch Hand

Joined: Jun 07, 2011
Posts: 208

Frits Walraven wrote:Hi Sagar,

If you are going to do the EE6 version of the EJB exam: skip all the paragraphs concerning EJB2.x.

Regards,
Frits


Just wanted to know their thought process behind it ....just out of curiosity
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Query related to Narrowing