• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session bean exception

 
Mayank Mishra
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 130 of head first EJB it is mentioned that if a session bean client calls remove(Object primaryKey) then the client gets a javax.ejb.RemoveException

However the API defines remove as :
public void remove(java.lang.Object primaryKey)
throws java.rmi.RemoteException,RemoveException

and its description says:
"Remove an EJB object identified by its primary key.
This method can be used only for an entity bean. An attempt to call this method on a session bean will result in a RemoteException."

Is this an error or is it something I am missing?I did not find it in March 18, 2005 errata as well.
 
seemapanth Joshi
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it has got something to do with what is explained in Page 545. Please read on and tell me if that is so. And after that I think if you could refer to page 59 of specification which states that:


Because session objects do not have primary keys that are accessible to clients, invoking the javax.ejb.EJBHome.remove(Object primaryKey) method on a session results in the javax.ejb.RemoveException.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The client will get a RemoveException. Remember, the EJB spec is the authority (and on which you will be tested), so overrules anything contrary in the API documentation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic