• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

doubt in ejb transaction

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone,

In my previous post i forgot to post the method flow for this question.I got the answer for the my second question in my previous post from the spec.





1. Select all combinations of transaction attributes that would make this scenario possible (without exceptions being thrown).

Method A (transaction A)
|
+- Method B (no transaction)
| |
| + Method C (transaction B)
|
+- Method D (transaction A)
|
+- Method E (transaction C)
|
+ Method F (no transaction)


A. B-Supports, C-Required, D-Supports, E-Required, F-NotSupported
B. B-NotSupported, C-Required, D-Mandatory, E-RequiresNew, F-NotSupported
C. B-NotSupported, C-RequiresNew, D-Required, E-RequiresNew, F-Never
D. B-Never, C-Required, D-Required, E-Mandatory, F-Never
E. B-NotSupported, C-RequiresNew, D-Supports, E-RequiresNew, F-NotSupported
F. B-NotSupported, C-Mandatory, D-Supports, E-RequiresNew, F-NotSupported


ans : b,e

My doubt in this question is that how come option B is right.

Below is my justification for option B not to be a right choice.

Here is this case since method B has trans attribute as 'not supported',it will suspend the
transaction(A) comming from the Method A and executes the method B without a transaction.
After method B completes, it will resume the suspened transaction(A) and calls method C with that transaction.
Here since method C has the trans attribute as required, it will continue to make use of the resumed transaction(A)
rather than starting a new transaction(B).But the requirement is that method C should start a new transaction B.


Pls correct me if iam wrong.
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
your assumption is correct.B is a wrong choice.
C-Required is not possible, it should be RequiresNew.
 
Shanmugam Karthikeyan
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Thanks for your reply.I think the answer given was correct.

Pls read the following para which i got from spec for notSupported.

If a client calls with a transaction context, the container suspends the association of the transaction context
with the current thread before invoking the enterprise bean�s business method. The container
resumes the suspended association when the business method has completed. The suspended transaction
context of the client is not passed to the resource managers or other enterprise Bean objects that are
invoked from the business method
.
If the business method invokes other enterprise beans, the Container passes no transaction context with
the invocation
.


regards

S.Karthikeyan
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
B and E right. See options B, the answer saying method-C is required. this starts a new transaction since method C is coming from Method B which is no transaction and 'required' guarantees creating transaction B.

so answers are: B, E
 
Don't destroy the earth! That's where I keep all my stuff! Including this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic