About Question enthuware.oce-ejbd.v6.2.467 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
deadlock_gr
Posts: 54
Joined: Tue Apr 19, 2011 10:32 am
Contact:

About Question enthuware.oce-ejbd.v6.2.467 :

Post 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?

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

Re: About Question enthuware.oce-ejbd.v6.2.467 :

Post 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.

deadlock_gr
Posts: 54
Joined: Tue Apr 19, 2011 10:32 am
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.467 :

Post 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?

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

Re: About Question enthuware.oce-ejbd.v6.2.467 :

Post 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.

perry

Re: About Question enthuware.oce-ejbd.v6.2.467 :

Post by perry »

the answer should be
None of this
because <transaction-attribute> should be <trans-attribute>

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

Re: About Question enthuware.oce-ejbd.v6.2.467 :

Post by admin »

You are right. This has been changed to <trans-attribute>

thanks for your feedback!

fjwalraven
Posts: 429
Joined: Tue Jul 24, 2012 2:43 am
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.467 :

Post 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

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

Re: About Question enthuware.oce-ejbd.v6.2.467 :

Post by admin »

Hi Frits,
This has now been updated with your suggestions. Thank you for your feedback!
Paul.

StefKlaassen

Re: About Question enthuware.oce-ejbd.v6.2.467 :

Post 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.

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

Re: About Question enthuware.oce-ejbd.v6.2.467 :

Post 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!

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests