wood burning stoves*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes EJB Exceptions.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "EJB Exceptions...." Watch "EJB Exceptions...." New topic
Author

EJB Exceptions....

Vijay Govind
Greenhorn

Joined: Oct 18, 2006
Posts: 27
Good Morning.

HFEJB on page #545, Qn #1, says that none of the container call back methods can throw any application exceptions and can throw only EJBExceptions. I agree with that. On page 548, it says a RemoveException (a checked exception) can be thrown with the client's invocation of a remove() method, which I belive can be translated as "throw RemoveException from ejbRemove() method if needed". My question is how can you throw a checked exception like RemoveException, when this exception is not defined in the throws class of the interface?

This could be basic java and I am not connecting something/somewhere and please fix my understanding.

TIA
Vijay.
Rajan Murugan
Ranch Hand

Joined: Jun 24, 2006
Posts: 182
If you check the api

Both EJBObject and EJBhome declare ejbRemove() as



public void remove(Handle handle)
throws java.rmi.RemoteException,
RemoveException

Remove an EJB object identified by its handle.

Throws:
RemoveException - Thrown if the enterprise Bean or the container does not allow the client to remove the object.
java.rmi.RemoteException - Thrown when the method failed due to a system-level failure.

May be this will give a clue.


With Regards,<br /> Rajan<br />"Java Rocks"
Vijay Govind
Greenhorn

Joined: Oct 18, 2006
Posts: 27
Duh....I was looking at the ejbRemove() signature while writing that question. Thanks a lot for the pointer.

Vijay.
Vijay Govind
Greenhorn

Joined: Oct 18, 2006
Posts: 27
Duh....Again. I was looking at the SessionBean's ejbRemove() signature while writing that question. Thanks a lot for the pointer.

Vijay.
Rajan Murugan
Ranch Hand

Joined: Jun 24, 2006
Posts: 182
Not only that on page no. 545 it further says...
you can throw only unchecked exceptions from a container callback that is not part of your client view
and remove is part of client (bcoz they are declared in home and ejbObject).

Refer to page no 375 spec. (18.3.1)
while describing about business methods ejbRemove() is considered Business method !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB Exceptions....
 
Similar Threads
Checked vs UnChecked
Barry Boone - Question #28 - Ambiguous
from khalid- protected void finalize throws throwable...
is HFEJB contradictory?
Can ejbRemove() throws RemoveException?