Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RemoveException, CreateException, FinderException and EJBException

 
rastin purr
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic