Page 1 of 1

About Question enthuware.oce-jpad.v6.2.394 :

Posted: Tue Sep 01, 2015 4:42 pm
by alex
Hi,

The correct answer is:
The bean A instance will be discarded if there is no exception handling code for call to mB().

The explanation is next:
Because the call to mB will throw a javax.ejb.TransactionRequiredLocalException, which extends from EJBException and thus is a system exception. If there is no exception handling for this call, the exception will propagate out of the Bean A instance, which will cause the Bean A instance to be discarded.

As I know if a bean receives RuntimeException(without @application exception) the transaction would be always rolled back (if active) and the bean itself should be discarded.
First time hear that such exceptions could be handled and bean would not be discarded.

Please check.

Re: About Question enthuware.oce-jpad.v6.2.394 :

Posted: Tue Sep 01, 2015 9:31 pm
by admin
The explanation is correct. A system exception causes a bean to be discarded when it is not handled i.e. thrown out of the bean to the container. A bean may contain code that causes a runtime exception to be thrown. If the bean doesn't handle it and lets it propagate out to the container, it will be discarded. Otherwise not.

Re: About Question enthuware.oce-jpad.v6.2.394 :

Posted: Wed Sep 02, 2015 4:27 pm
by alex
Hi,
Thank you very much for the clear explanation.

Re: About Question enthuware.oce-jpad.v6.2.394 :

Posted: Sat Mar 25, 2017 1:58 pm
by javabean68
Hi all,

I didn't understand why is the answer A wrong...doesn't mA indeed get a javax.transaction.TransactionRequiredException?

Thank you
Regards
Fabio

Re: About Question enthuware.oce-jpad.v6.2.394 :

Posted: Sat Mar 25, 2017 10:03 pm
by admin
No, as the explanation says, it will get javax.ejb.EJBTransactionRequiredException.