aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Mock question from Headfirst EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Mock question from Headfirst EJB" Watch "Mock question from Headfirst EJB" New topic
Author

Mock question from Headfirst EJB

Elinor Chang
Ranch Hand

Joined: Jul 30, 2003
Posts: 58
I don't quite understand the following mock exam question from the book:

Given a remote client R, that has valid reference to session beans A and B, and given that A is a local client to B, which statements are true? (Choose all that apply)

1. R cannot pass his reference for A, to B
2. A cannot pass his reference for B, to R
3. A cannot invoke methods on B
4. B cannot invoke methods on R

the answer is 2, 4

What does the question is all about? Why the answers?

Thanks


The more I learn, the less I know....<br /> <br />SCJP2 <br />SCWCD
Ana Nava
Greenhorn

Joined: May 25, 2004
Posts: 24
What does the question is all about?


This question tests the following EJB2.0 Spec.

A client can pass a remote home object reference to another application. The receiving application can use the home interface in the same way that it would use a remote home object reference obtained via JNDI.

A client can pass a local home object reference to another application through its local interface. A local home object reference cannot be passed as an argument or result of a method on an enterprise bean�s remote home or remote interface.

The above Specs clearly explain the answers as well.
Miki Muzsi
Ranch Hand

Joined: Jun 23, 2003
Posts: 120
I am also very confused in this question.

First of all, if A is local to B, how can R (a remote) have a reference to A (a local)? Is that possible? And what about that Local and Remote should never ever be mixed?

Second, why can A call methods on B? They both use the local interfaces?

Miki


Miki<br /> <br />SCJP 1.4, SCBCD 1.3
Ana Nava
Greenhorn

Joined: May 25, 2004
Posts: 24
Ok lets analyze the question piece by piece...

Given a remote client R, that has valid reference to session beans A and B


As R (a remote client) has "valid" reference this means that it has a remote reference to A and remote reference to B.

1. R cannot pass his reference for A, to B


This is not a right choice because R can pass his remote reference of A to B as per the Spec "A client can pass a remote home object reference to another application".

and given that A is a local client to B


Although R has a remote reference to B, A has a local reference to B. (yes it is possible, but should be done with attention due to the reasons stated in page, 164 of HFEJB).

So choice 2 would be right because we cannot pass a local reference (A) to a remote reference (B to R).

Choice 3 is not right because, A can invoke methods on B.

Hope this helps...
Miki Muzsi
Ranch Hand

Joined: Jun 23, 2003
Posts: 120
Ana, it is very clear now. Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mock question from Headfirst EJB