Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling remove() on bean

 
Sany Bel
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 559 of HFE book, it is mentioned that when a client calls remove() on a bean that's already been removed, clients get RemoteException/EJBException. But, I thought they should get NoSuchObjectException/NoSuchObjectlocalException.
However, on page 563 question #2 mentions that the clients will get
NoSuchObjectException/NoSuchObjectlocalException.
Which one is correct?
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NoSuchObjectException/NoSuchObjectlocalException are thrown when the client invokes a method on a bean which has been removed. This is not the same as a client calling remove() on a bean that's already been removed.
 
Sany Bel
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HFE page 559 says that remove() should be treated as any other business method.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my understanding.
You get NoSuchObjectException thrown if the client tries to invoke a method by using a stub to the EJB Object which is not usable - gone, corrupt, whatever.
You get RemoteException thrown if the client, using a stub to a valid EJB Object, invokes remove or any other business method on a bean that's already been removed.
 
Dale Seng
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Discussed with some good conclusions here.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!