File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes RemoveException, CreateException, FinderException and EJBException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "RemoveException, CreateException, FinderException and EJBException" Watch "RemoveException, CreateException, FinderException and EJBException" New topic
Author

RemoveException, CreateException, FinderException and EJBException

rastin purr
Ranch Hand

Joined: Jul 20, 2002
Posts: 73
Is CreateException, FinderException, RemoveException and EJBException applicable to their respective methods? Say CreateException is thorwn when problems in creating a bean instance and finder when canno find bean due to (maybe connection or sql error) etc. RemoveException when ejbRemove encounter problems and EJBException when business methods cannot succeed? In sun tutorial all methods throw EjbException which confused me. Could someone shed some light on this issue please?
Thanks a lot
Rastin
Rick Hightower
Author
Ranch Hand

Joined: Feb 20, 2002
Posts: 350
EJBExcpetion is a runtime exception so you do not have to declare it in the throws clause. (It is also a wrapper exception....)
The tutorial is wrong. Doing such will cause the verifier in deploytool to declare this as an error.
All system exceptions are runtime exceptions in EJB. If you the container encounters a system exception, it will automagically role back the current transaction.
CreateException and RemoveException are application exceptions (non system, i.e., non runtimes). If the container encounters them, it will not automagiacally role back the current transaction.... it is up to the client if the transaction context gets propagated that far to handle the exception and roll back the transaction if needed.


Rick Hightower is CTO of Mammatus which focuses on Cloud Computing, EC2, etc. Rick is invovled in Java CDI and Java EE as well. linkedin,twitter,blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RemoveException, CreateException, FinderException and EJBException