Page 1 of 1
About Question enthuware.oce-ejbd.v6.2.467 :
Posted: Wed May 04, 2011 10:22 am
by deadlock_gr
The answer that is marked as correct is:
Both the methods, method1 and method2, may be invoked within a transaction and no exception will be thrown.
But, since the transaction is suspended, how are the two methods called
within that transaction?
Re: About Question enthuware.oce-ejbd.v6.2.467 :
Posted: Sat May 07, 2011 8:37 am
by admin
The calling method may call the given methods within a transaction. In this case, the transaction will be suspended but the caller doesn't know that. No exception will be thrown.
Re: About Question enthuware.oce-ejbd.v6.2.467 :
Posted: Sun May 08, 2011 2:35 pm
by deadlock_gr
True, I agree with the second part of the answer saying that "no exception will be thrown".
I don't agree with the second part of the answer saying that the methods "may be invoked within a transaction". Yes, the calling method may have a transaction context, which will be suspended when calling the methods. Since the TX is suspended, the methods don't run within a transaction.
Isn't this true?
Re: About Question enthuware.oce-ejbd.v6.2.467 :
Posted: Sun May 08, 2011 2:59 pm
by admin
The options says, "...may be invoked within a transaction...". It doesn't claim that the the methods will be executed within a transaction. As noted before, even if the caller has a transaction, it can call i.e. invoke the methods. So you are in fact invoking the methods from within a transaction. That the transaction is suspended by the container and the method do not execute within that transaction is also true but it is not what the question is referring to.
Re: About Question enthuware.oce-ejbd.v6.2.467 :
Posted: Fri Aug 05, 2011 5:11 am
by perry
the answer should be
None of this
because <transaction-attribute> should be <trans-attribute>
Re: About Question enthuware.oce-ejbd.v6.2.467 :
Posted: Sun Aug 07, 2011 9:20 am
by admin
You are right. This has been changed to <trans-attribute>
thanks for your feedback!
Re: About Question enthuware.oce-ejbd.v6.2.467 :
Posted: Sun Oct 21, 2012 4:15 am
by fjwalraven
I agree with the previous remarks, as it is not clear if "the transaction" applies to the caller or to the methods itself
and I would rephrase the option:
"Both the methods, method1 and method2, may be invoked within a transaction and no exception will be thrown."
into
"Both the methods, method1 and method2, may be invoked from a client with a transaction-context and no exception will be thrown."
Apart from this remark, I would change:
Code: Select all
@TransactionManagement(CONTAINER)
@TransactionAttribute(REQUIRES_NEW)
into
Code: Select all
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
as you are now assuming:
Code: Select all
import static javax.ejb.TransactionManagementType.*;
import static javax.ejb.TransactionAttributeType.*;
this way people get used to the real constants
Regards,
Frits
Re: About Question enthuware.oce-ejbd.v6.2.467 :
Posted: Sun Oct 21, 2012 6:18 am
by admin
Hi Frits,
This has now been updated with your suggestions. Thank you for your feedback!
Paul.
Re: About Question enthuware.oce-ejbd.v6.2.467 :
Posted: Sun Nov 04, 2012 3:36 pm
by StefKlaassen
I checked "none of these", since
Code: Select all
@TransactionAttribute(TransactionManagementType.REQUIRES_NEW)
public void method1() {...}
would not even compile... It should be TransactionAttributeType.REQUIRES_NEW and in that case answer 3 would be correct.
Re: About Question enthuware.oce-ejbd.v6.2.467 :
Posted: Sat Nov 10, 2012 11:05 am
by admin
StefKlaassen wrote:I checked "none of these", since
Code: Select all
@TransactionAttribute(TransactionManagementType.REQUIRES_NEW)
public void method1() {...}
would not even compile... It should be TransactionAttributeType.REQUIRES_NEW and in that case answer 3 would be correct.
This has now been fixed.
thank you for your feedback!