Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transaction Scenario Question (Help)

 
Sandeep Lodhia
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
The following is an question I found on scea_j2ee forum.
There are two Enterprise Java Beans, A and B. A
method in "A" named "Am" begins execution, reads a
value v from the database and sets a variable
"X" to value v, which is one hundred. "Am" adds fifty to the variable X and updates the database with the new value of X. "Am" calls "Bm", which is
a method in B. "Bm" begins executing. "Bm" reads an additional value from the database. Based on the value, "Bm" determines that a business rule has been violated and aborts the transaction. Control is returned to "Am".
Requirement:
If "Bm" aborts the transaction, it is imperative that the original value be read from the database and stored in variable X.
Given the scenario above, which Transaction Attributes will most likely meet the requirements stated?
a A-RequiresNew, B-Mandatory
b A-Mandatory, B-RequiresNew
c A-RequiresNew, B-Supports
d A-NotSupported, B-RequiresNew
e A-RequiresNew, B-RequiresNew
I have 2 questions :
1. Which is the most correct answer for abvoe question ?
2. In SCEA part I exam, do they ask similar kind of question ?
I have studied EJB but I do not have any idea of taste of questions in exam.
I'd be highly thankful if some body can come up with 1 sample question of each objectives.
Thanx in Anticipation.
Sandeep.
 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IMHO
#1 A and C
#2 Yes they do.
#3 Ian has a nice exam.
 
Sankar Subbiramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sandeep,
You can get scenarion questions like this. In such situations, take your time to understand the problem. Answer by eliminating the most improbable ones. Then you have the task easier.
For eg, in the problem you mentioned the requirement is " "Bm" aborts the transaction, it is imperative that the original value be read from the database and stored in variable X."
This implies,
1) Am is running under a transaction context
2) Am and Bm should be in the same transaction.
Now look at the answers:
Eliminate answers which state "Not Supported" or "Never" as transaction attribute (see point 1 above)
Eliminate those which specify "Requires New" for Bm. ( see point 2 above)
Now you are left with 2 choices. Analyse them.
If Am has "Requires new" it doesnot matter whether Bm has txn attribute as "Mandatory" or "Supports"
So the answer is A and C.
(Good Luck)
regards
sangam
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic