File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Mock exam question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Architect Certification (SCEA/OCMJEA)
Reply Bookmark "Mock exam question" Watch "Mock exam question" New topic
Author

Mock exam question

Shankar Ranganathan
Ranch Hand

Joined: Sep 19, 2001
Posts: 71
True or false: an EJB cannot implement both local and remote business methods
POSSIBLE ANSWERS:
* True
* False
SOLUTION:
False, it can, allthough unusual
I don't understand this.


Shankar<br />Post mock questions in<br /><a href="http://groups.yahoo.com/group/scea_mock" target="_blank" rel="nofollow">http://groups.yahoo.com/group/scea_mock</a>
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
Hi there,
I understand this to mean that an EJB can implement but the EJBHome and EJBLocalHome interfaces. The first can be used with remote clients) i.e. those originating outside the host JVM.) The latter can be used with local clients (i.e. those originating within the host JVM.)
Darryl
Shankar Ranganathan
Ranch Hand

Joined: Sep 19, 2001
Posts: 71
Hi Darryl,
I know what you are saying. But what I understood from that qn. is whether an ejb can implement both the local interface and as remote interface at the same time. That is why I was confused.
Thanks
Shankar
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
Hi there,
They can implement both EJBHome and EJBLocalHome at the same time. I can't think offhand of any reasons for doing this but I can think of reasons for not doing this. Such beans could not be CMP entity beans since CMP only supports local interfaces. Also, the performance optimizations you might want to implement for local interfaces might not be the same as performance optimizations for remote interfaces. Still, implementing a bean with local and remote home interfaces would allow you to support server-side web-based applications as well as remote applications, beans running in other containers, and Swing applications.
Darryl
Thomas Hofmann
Ranch Hand

Joined: Nov 23, 2002
Posts: 72
The business methods are defined in the component interface. Beside the EJBHome and EJBLocalHome the bean implementing "local and remote business methods" has to provide also both local and remote component interfaces, which extends EJBLocalObject and EJBObject, respectively. Thus, the business methods has to be defined in both component interfaces, but only implemented once in the bean class.
Thomas
Thomas Hofmann
Ranch Hand

Joined: Nov 23, 2002
Posts: 72

The business methods are defined in the component interface.

Sorry, I meant: The busines methods are declared in the component interface.
Rama Raghavan
Ranch Hand

Joined: Aug 22, 2001
Posts: 116
When beans are to be accessed from within the application (that the EJB is part of) local interfaces improve performance.
When beans are to be accessed from applications deployed on other JVMs (or different classloader hierarchy), then remote interfaces are your only choice.
If the same bean is accessed from within the application, as well as other applications, then I'd provide both local and remote interfaces to the same bean.
Rama
Shankar Ranganathan
Ranch Hand

Joined: Sep 19, 2001
Posts: 71
Thank you guys.
 
 
subject: Mock exam question
 
Threads others viewed
Short Circuit AND
Double doubt
plz need help
only static methods can access static members
You can directly run the GC whenever you want to ?????
IntelliJ Java IDE