• 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

Client View of a Session Bean - Mock Question

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please find below mock question from ejbcertificate.com:

Which of the following statements regarding session beans are true? [Check all correct answers]
1. Invoking javax.ejb.EJBObject.getPrimaryKey() on a session bean results in javax.ejb.EJBException been thrown.
2. Invoking javax.ejb.EJBLocalObject.getPrimaryKey() on a session bean results in javax.ejb.EJBException been thrown.
3. Invoking javax.ejb.EJBHome.remove(java.lang.Object primaryKey) on a session bean results in javax.ejb.RemoveException been thrown.
4. Invoking javax.ejb.EJBLocalHome.remove(java.lang.Object primaryKey) on a session bean results in javax.ejb.RemoveException been thrown.
5. Invoking javax.ejb.EJBHome.remove(java.lang.Object primaryKey) on a session bean results in java.rmi.RemoteException been thrown.

You have answered: 2 3 4


Explanation:
Answer 2 and 5 are correct. Answer 2 is correct because the method javax.ejb.EJBLocalObject.getPrimaryKey() can only be invoked on an entity bean. An attempt to invoke the method on a session bean results in javax.ejb.EJBException been thrown. Answer 5 is correct because javax.ejb.EJBHome.remove(java.lang.Object primaryKey) can only be invoked on an entity bean. An attempt to invoke the method on a session bean results in java.rmi.RemoteException been thrown.

Answers 1, 3 and 4 are incorrect. Any methods associated with a primary key defined by a local home or component interface raises a javax.ejb.EJBException if the method is invoked on a session bean. Likewise, any methods associated with a primary key defined by a remote home or component interface raises a java.rmi.RemoteException if the method is invoked on a session bean.



My Explanation:
Answer 5 is wrong.
Please refer section "6.6 Session object identity" of EJB Specification which clrealy states as mentioned below:
EJBHome.remove(Object primaryKey) and the EJBLocalHome.remove(Object primaryKey)methods result in a javax.ejb.RemoveException if called on a session bean.

So correct answers are 2, 3 and 4.

Any comments on above?
[ November 04, 2004: Message edited by: Sandesh Tathare ]
 
Bartender
Posts: 1155
20
Mac OS X IntelliJ IDE Oracle Spring VI Editor Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Only yesterday, creating session beans [and the specification] were answered (but, I got it a bit wrong at first)

CMP and specification.
 
Sandesh Tathare
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

The answers provided by ejbcertificate.com was wrong. Today I received confirmation from their end. They have updated their database accordingly.

Thanks ejbcertificate.com team for providing lovely site for testing our knowledge.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic