• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

a mock question

 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
31. Given this code:
try {
Advice a = aHome.create();
Handle aHandle = a.getHandle();
} catch (Exception ex) {...}
which are true? (assume everything compiles and works
A) aHandle must be Serializable.
B) Advice must extend EJBHome
C) The object referenced by aHandle is from a class implemented
the container
D) The Bean Provider implemented the aHome.create() method.
E) getHandle() declares a RemoteException
F) Handle extends java.rmi.Remote
G) The object referenced by 'a' IS-A java.rmi.Remote
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the answer g ?
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A) aHandle must be Serializable.
B) Advice must extend EJBHome
C) The object referenced by aHandle is from a class implemented
the container
D) The Bean Provider implemented the aHome.create() method.
E) getHandle() declares a RemoteException
F) Handle extends java.rmi.Remote
G) The object referenced by 'a' IS-A java.rmi.Remote

A - yes; Handles implement the javax.ejb.Handle interface and that interface extends Serializable [see EJB API specification]

B. no - Advice is an EJB Object reference, therefore it must implement EJBObject, not EJBHome.

D.- no; the bean provider provides only the component interface, i.e. only the create method declaration. The container is responsible for the actual implementation. The create() method here would be implemented in the Session EJBHome class implemented by the container [see spec page 100]

E. yes; since EJBObject implements java.rmi.Remote, every method declaration must contain in RemoteException in the throws clause. In this case: public Handle getHandle()
throws java.rmi.RemoteException

F - no; see API documentation

G. yes; every EJB Object is-a Remote object [i.e. indirectly implements the java.rmi.Remote interface]

C - yes; the deployment tools are responsible for implementing the handle classes for the session bean's remote home and component interfaces [see EJB2.0 spec page 101]
[ August 27, 2005: Message edited by: Mihai Alexe ]
 
Please do not shoot the fish in this barrel. But you can shoot at this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic