• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on a question from JDiscuss.com

 
Prathibha Bharathi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem :

A client has just called a business method on an entity bean on which another client has already called theBean.remove(). What will happen?

Options:

Select 1 correct option.

a.A new entity bean is created and the method is executed on that bean.
b.The method call will return immediately without returning any output.
c.The client will get javax.ejb.EJBException
d.The container will route the call to another container within the cluster (if it exists).
e.The client will get javax.ejb.NoSuchObjectLocalException if it is a local client.(And will get a java.rmi.NoSuchObjectException if it is a remote client.)


Answer is E.

But .... according to HFEJB , when client calls remove on a bean that's already removed -

Remote clients get RemoteException
LocalClients get EJBException . (page No :559)

Please help me!

Regards,
Prathibha
 
seemapanth Joshi
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is What I see:

the jdiscuss questions asks:

client has just called a business method on an entity bean..

and if you would open the spec page 132 remove protocol, it says:

The Container must detect any subsequent attempt to invoke an accessor method on the removed entity object and throw the java.rmi.NoSuchObjectException if the client is a remote client or the javax.ejb.NoSuchObjectLocalException if the client is a local client.

the business method here could be the accessor method.

and as far as the HFEJB it says:

Client calls remove on a bean that has already been removed


and if you check in the list there is a big thread going on titled "System Exception Confusion " and about 23 more threads (if you search on page 559) that discuss this page and scenario from HFEJB:
http://www.coderanch.com/t/161147/java-EJB-SCBCD/certification/System-Exception-Confusion

I have my own confusions on exceptions and I am trying to clear them up following them and more similar thread....I would advice you to join the group.....
[ August 23, 2005: Message edited by: seemapanth Joshi ]
 
Prathibha Bharathi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You Joshi!
My doubt is now clarified! But why the inconsistency bwn the book and spec.... Eventhough I believe on the exam , they won't ask questions having these 2 responses ....
a. RemoteException to the Remote clients and EJBException to the local clients
b. NoSuchObjectException to the Remote client and NoSuchObjectLocalException to the local client ...

But what if a question like this appears on the exam ..........
what to choose ?

Thanks and Regards,
Prathibha.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Prathibha Bharathi:
a. RemoteException to the Remote clients and EJBException to the local clients
b. NoSuchObjectException to the Remote client and NoSuchObjectLocalException to the local client ...

But what if a question like this appears on the exam ..........
what to choose ?


If the question asks you to select exactly one answer pick (b). If the question asks you to select more than one answer pick (a) and (b).
If SCBCD follows the style of SCJP and SCWCD there won't be any infamous "select all that apply" - even then both (a) and (b) apply (thanks to inheritance), its just a question if the question designer sees it that way (That would be the type of question you would leave comments for if you are given the opportunity).
 
Prathibha Bharathi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the question asks you to select exactly one answer pick (b).


Thank You Peer!
Regards,
Prathibha
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic