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

Moderator: admin

Post Reply
alex
Posts: 42
Joined: Tue Feb 12, 2013 4:35 pm
Contact:

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

Post by alex » Tue Sep 01, 2015 4:42 pm

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.

admin
Site Admin
Posts: 8297
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin » Tue Sep 01, 2015 9:31 pm

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.
If you like our products and services, please help us by posting your review here.

alex
Posts: 42
Joined: Tue Feb 12, 2013 4:35 pm
Contact:

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

Post by alex » Wed Sep 02, 2015 4:27 pm

Hi,
Thank you very much for the clear explanation.

javabean68
Posts: 29
Joined: Wed Mar 16, 2016 8:38 am
Contact:

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

Post by javabean68 » Sat Mar 25, 2017 1:58 pm

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

admin
Site Admin
Posts: 8297
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin » Sat Mar 25, 2017 10:03 pm

No, as the explanation says, it will get javax.ejb.EJBTransactionRequiredException.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests