Hi, consider mock exam question.
How will the
EJB container handle exceptions thrown by a business method of a bean with container managed transaction demarcation? [Check all correct answers]
1 If the instance called setRollbackOnly(), the EJB container will rollback the transaction.
2 If the instance did not call setRollbackOnly(), the EJB container will commit the transaction.
3 The EJB container will throw a RemoteException.
4 If the bean represents an entity bean, it will remove the entity from the datasource.
5 If the bean represents a session bean, the bean will be removed from the pool.
Exam soln: 1,2
I thought that if CMT bean throws App Exception , the container will not rollback the ex.But if the setRollbackOnly is already called, the container will roll back the Tx.
But if setRollbackOnly is not called, i thought, that client can continue with transaction and tx. is not rollbacked.
If client can continue with tx, he may still decide if he wants to commit or rollback the same Tx later....this doesnt mean that container will commit it...???
Am I missing something???
i selected for 1 only and I was wrong according to exam
Amol.