File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes EJB Transactions Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "EJB Transactions Query" Watch "EJB Transactions Query" New topic

EJB Transactions Query

Alka Sharma

Joined: Sep 02, 2002
Posts: 16
Here is a question from Epractize mock exam.

ATMEJB has a method withdrawal() with required transaction attribute and is calling AccountEJB method getAmount(). At the same time, ChequeProcessorSessionEJB is calling getAmount() method of AccountEJB without any transaction context.

The alogorithm for getAmount() is to deduct the amount from account balance, calculate interest, update history and return the requested amount to the caller.

Question : What best describes the AccountEJB component?

a) AccountEJB should be stateless seesion EJB with RequiresNew transaction attribute for getAmount()
b) AccountEJB should be implemented as BMP with Required transaction attribute for getAmount()
c) AccountEJB should be implemented as CMP with Supports transaction attribute for getAmount()
d) AccountEJB should be implemented as CMP with RequiresNew transaction attribute for getAmount()

The correct answer mentioned is d)

But I am not convinced with RequiresNew transaction attribute for getAmount() as if getAmount() method is executed successfully but withdrawal() method fails, still the amount will be deducted from customer's account.

In my understanding Required should be the transaction attribute, but i don't see any need for BMP here.

Please comment.

- Tinu
Santiago Urrizola
Ranch Hand

Joined: Apr 27, 2006
Posts: 172
i think required should be transaction attribute.

Santiago Urrizola : La Plata - Argentina<br />SCEA (89%-92%)<br /><a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: EJB Transactions Query
jQuery in Action, 3rd edition