• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

about EPractice Lab mock 2 question 9, stateless/stateful bean

 
Bartender
Posts: 2037
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EPractice Lab, mock 2 exam question 9 ,


ATMEJB has method withdrawal() with Required transaction attribute and it is calling AccountEJB method getAmount(). At the same time, ChequeProcessorSessionEJB is calling getAmount() method of AccountEJB without any transaction context.
The algorithm for getAmount() is to deduct the amount from account balance, calculate interest, update history and return the requested amount to the caller.

What best describes the AccountEJB component?
a: AccountEJB should be stateless session EJB with Requires New transaction attribute for getAmount();
b: AccountEJB should be implemented as stateful session bean with Requires transaction attribute for getAmount();
c: AccountEJB should be implemented as message driven bean with support attribute for getAmount();
d: AccountEJB should be implemented as stateless session EJB with RequiresNew transaction attribute for getAmount();



First , I think choice a and d are the same.
Second, I think AccountEJB can be a stateful bean and getAmount() can have Require attribute .
Reasons:
1. getAmount() will executed either in the withdrawal()'s transaction or starts its own transaction.
2. It is fine to have two different AccountEJB instances for ATMEJB and ChequeProcessorSessionEJB respectively. The two instances of bean can access the database of a bank account at the same time to handle the amount deduction. The database can handle concurrent access.

Of course, AccountEJB can also be stateless, as I believe.
 
pie. tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic