About Question enthuware.oce-jpad.v6.2.406 :
Moderator: admin
-
- Posts: 9
- Joined: Sat May 09, 2015 6:30 am
- Contact:
About Question enthuware.oce-jpad.v6.2.406 :
"The bean A instance will NOT be discarded." I believe this answer is analogous to the "Changes made to the database by mA(), will be committed." - outcome in those 2 questions might happen, but we cannot be sure they will happen.
The bean A's instance can recover from the exception, but it might also not recover, and thus be discarded. That is why in my opinion this answer should be rephrased to something like "The bean A instance might not be discarded."
The bean A's instance can recover from the exception, but it might also not recover, and thus be discarded. That is why in my opinion this answer should be rephrased to something like "The bean A instance might not be discarded."
Online
-
- Site Admin
- Posts: 10078
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.406 :
Your point is valid but that is not what the question is about. Bean A will not be not be discarded because of a runtime exception thrown by Bean B. Bean A will be discarded if a runtime exception is thrown out of Bean A but that is not the point in the question. The question is only only talking about the effects of runtime exception thrown by Bean B.
HTH,
Paul.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 6
- Joined: Mon Jun 16, 2014 9:47 am
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.406 :
Well, both cases might only happens because of the runtime exception thrown by Bean B.
So, both cases might occur or not.
So, both cases might occur or not.
-
- Posts: 8
- Joined: Sun Dec 20, 2015 6:28 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.406 :
Another Question:
What I don't understand: about the exception that is thrown it is only known that it is a RuntimeException. Thus it might be a System Exception as RuntimeExceptions are per default System Exceptions (14.2.2) or it might be an Application Exception if it is annotated with @ApplicationException (as per section 14.2.1).
So if the exception can be either App or System Exception then Bean A might either receive an EJBException (if System Exception in B) or the re-thrown Application Exception (if Application Exception in B) (section 14.3.1, Table 15, method condition: Required and RequiresNew).
So how can this option be correct:
What I don't understand: about the exception that is thrown it is only known that it is a RuntimeException. Thus it might be a System Exception as RuntimeExceptions are per default System Exceptions (14.2.2) or it might be an Application Exception if it is annotated with @ApplicationException (as per section 14.2.1).
So if the exception can be either App or System Exception then Bean A might either receive an EJBException (if System Exception in B) or the re-thrown Application Exception (if Application Exception in B) (section 14.3.1, Table 15, method condition: Required and RequiresNew).
So how can this option be correct:
The Bean A will get a javax.ejb.EJBException but it may continue with the same transaction
Online
-
- Site Admin
- Posts: 10078
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.406 :
You are right. The problem statement should mention that the RTE thrown by mB() is not marked as an application exception.
thank you for your feedback!
Paul.
thank you for your feedback!
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 6
- Joined: Mon Sep 23, 2013 5:19 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.406 :
Hello,
I`m a little confused regarding the answer
The Bean A will get a javax.ejb.EJBException but it may continue with the same transaction.
In my understanding when a RuntimeException is throw, the behavior should be
1) roll back the transaction 2) discard the EJB Bean instance 3) Throw a javax.ejb.EJBException
There is no place saying that Bean A is treating (catching) the transaction, if no try catch was defined should Bean A continue the transaction?
Thanks
I`m a little confused regarding the answer
The Bean A will get a javax.ejb.EJBException but it may continue with the same transaction.
In my understanding when a RuntimeException is throw, the behavior should be
1) roll back the transaction 2) discard the EJB Bean instance 3) Throw a javax.ejb.EJBException
There is no place saying that Bean A is treating (catching) the transaction, if no try catch was defined should Bean A continue the transaction?
Thanks
Online
-
- Site Admin
- Posts: 10078
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.406 :
That is because bean B's transaction attribute is RequiresNew. Therefore, its method executes in a transaction that is different from Bean A's transaction. It cannot affect the transaction of Bean A.
HTH,
Paul.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 6
- Joined: Mon Sep 23, 2013 5:19 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.406 :
Thanks Paul
-
- Posts: 125
- Joined: Thu Jul 05, 2018 6:44 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.406 :
Is it the case that bean B would get EJBTransactionRolledbackException, and that this same exception is wrapped into the EJBException that is returned to bean A?
-
- Posts: 125
- Joined: Thu Jul 05, 2018 6:44 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.406 :
Also, in looking at table 15 in the EJB spec, they seem only to list the simple case where a client calls a bean; but in the questions in these mock exams the client calls bean A which then calls bean B; is it the case that when (in these questions) "the client" calls bean A and bean A calls bean B, that bean A is a client of bean B (for the purposes of reading table 15), whilst also it being the case that "the client" (as named in the question) is (obviously) the client of bean A?
Online
-
- Site Admin
- Posts: 10078
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.406 :
Yes, "client" is relative. The caller, even if it is a bean, is the "client" when it invokes another bean.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 2 guests