posted 19 years ago
Hello ranchers,
the spec contains on the pages 375 and 376 the following informations what happens after throwing a system exceptions:
- Log the exception.
- Mark the transaction for rollback.
- Discard instance. Discard instance means that the Container must not invoke any business methods or container callbacks on the instance.
Today, I have worked with a session bean mock-exam from ejb-certificate, and there was the following question:
Given that a stateful session bean implements the SessionSynchronization interface, select the correct order in which a container calls a transactional business method that throws a system exception.
The correct answer was:
afterBegin(), business method, afterCompletion()
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.
The spec wrotes, that after a system exception the instance will be discarded, and that the Container must not invoke any business methods or container callbacks on the instance. But afterCompletion() is a container-callback-method, isn't it?
Why does the Container calls afterCompletion() after a system exception? I have thought that the container will invoke NO method on the bean-instance after a system exception has occurred.
Regards,
Oliver