File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB Transactions Query

 
Alka Sharma
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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?

Answers:
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.

TIA,
- Tinu
 
Santiago Urrizola
Ranch Hand
Posts: 172
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think required should be transaction attribute.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic