But, since the transaction is suspended, how are the two methods called within that transaction?Both the methods, method1 and method2, may be invoked within a transaction and no exception will be thrown.
About Question enthuware.oce-ejbd.v6.2.467 :
Moderators: Site Manager, fjwalraven
- 
				deadlock_gr
 - Posts: 54
 - Joined: Tue Apr 19, 2011 10:32 am
 - Contact:
 
About Question enthuware.oce-ejbd.v6.2.467 :
The answer that is marked as correct is:
			
			
									
									
						- 
				admin
 - Site Admin
 - Posts: 10443
 - Joined: Fri Sep 10, 2010 9:26 pm
 - Contact:
 
Re: About Question enthuware.oce-ejbd.v6.2.467 :
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 :
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?
			
			
									
									
						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: 10443
 - Joined: Fri Sep 10, 2010 9:26 pm
 - Contact:
 
Re: About Question enthuware.oce-ejbd.v6.2.467 :
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 :
the answer should be 
			
			
									
									
						because <transaction-attribute> should be <trans-attribute>None of this
- 
				admin
 - Site Admin
 - Posts: 10443
 - Joined: Fri Sep 10, 2010 9:26 pm
 - Contact:
 
Re: About Question enthuware.oce-ejbd.v6.2.467 :
You are right. This has been changed to <trans-attribute>
thanks for your feedback!
			
			
									
									
						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 :
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:into
as you are now assuming:
this way people get used to the real constants
Regards,
Frits
			
			
									
									
						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)
Code: Select all
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
Code: Select all
import static javax.ejb.TransactionManagementType.*;
import static javax.ejb.TransactionAttributeType.*;
Regards,
Frits
- 
				admin
 - Site Admin
 - Posts: 10443
 - Joined: Fri Sep 10, 2010 9:26 pm
 - Contact:
 
Re: About Question enthuware.oce-ejbd.v6.2.467 :
Hi Frits,
This has now been updated with your suggestions. Thank you for your feedback!
Paul.
			
			
									
									
						This has now been updated with your suggestions. Thank you for your feedback!
Paul.
- 
				StefKlaassen
 
Re: About Question enthuware.oce-ejbd.v6.2.467 :
I checked "none of these", since 
would not even compile... It should be TransactionAttributeType.REQUIRES_NEW and in that case answer 3 would be correct.
			
			
									
									
						Code: Select all
@TransactionAttribute(TransactionManagementType.REQUIRES_NEW)
   public void method1() {...} - 
				admin
 - Site Admin
 - Posts: 10443
 - Joined: Fri Sep 10, 2010 9:26 pm
 - Contact:
 
Re: About Question enthuware.oce-ejbd.v6.2.467 :
This has now been fixed.StefKlaassen wrote:I checked "none of these", sincewould not even compile... It should be TransactionAttributeType.REQUIRES_NEW and in that case answer 3 would be correct.Code: Select all
@TransactionAttribute(TransactionManagementType.REQUIRES_NEW) public void method1() {...}
thank you for your feedback!
Who is online
Users browsing this forum: Google Adsense [Bot] and 14 guests