posted 16 years ago
I need some clarifications regarding exception exercise from HFEJB PGNO:547.
Given Options:
A. Throw an EJBException
B. Throw a RemoteException
C. Invoke setRollbackOnly()
D. Allow the exception to propagate.
Scenarios:
1. You catch a checked exception in your ejbActivate method. The method is not in a transaction.
Ans: I think we cant throw any checked exception from ejbActivate(and some other container callback methods), the option would be A.
2.A DivideByZero exception occurs as your business logic is running. You do not have a try/catch for this.
Ans: A/B
3.You throw a CreateException from your ejbCreate() method and you realize that you probably cannot safely complete your transaction
Ans:C,D
4.You catch a Checked exception in a business method and realize that your bean is probably corrupt.
Ans:C,D
Please correct me if iam wrong in any of the scenarios.
Thank you