posted 17 years ago
I have a doubt in question hosted on ejbcertificate.com
Here is the question:
Given that a stateful session bean implements the SessionSychronisation interface, select the correct order in which a container calls a transactional business method that throws a system exception.
1 beforeBegin(), business method, afterCompletion().
2 beforeBegin(), afterBegin(), business method, afterCompletion().
3 afterBegin(), business method, beforeCompletion(), afterCompletion().
4 afterBegin(), business method, afterCompletion().
The answer given is 4. And Explanation given is:
If a business method raises a system exception whilst in the context of transaction, afterCompletion() is called on the session bean instance with a boolean value of false to notify the instance that a rollback has occurred.
Now my concern is... Once a System Exception is raised.. the Container will kill the session bean instance.. then how come afterCompleion be called??
SCJP 1.4 : 91%
SCWCD 1.4 : 95%
SCBCD 1.3 : 95%
SCJP 6 Upgrade : 95%
Next SCBCD 1.5
Man is not finished when he is defeated. He is finished when he quits.