The following question is from the Whizlabs
SCEA simulator -
You have been contracted by a movie memorabilia company to set up an online shop. The company buys bulk goods from movie sets (stage props, costumes, gadgets etc), splits them into single items and then auctions them. The company used to hire sports halls or community centers to auction items in a traditional manner. They predict that by moving to an online solution they will reach a wider audience and make a greater profit despite the initial investment that the new system will involve. Which of the following is the most suitable initial design for this application?
A The business logic will be handled in a servlet
B The business logic will be handled in a Stateful Session Bean
C Use Container Managed Transactions
D Use Bean Managed Transactions
E The customer will be represented with an Entity Bean
F There is no need for a customer bean as a customers interaction with the site is just business logic and will be handled in the Servlet/Stateful Session Bean
G Use Container Managed Persistence
H Use Bean Managed Persistence
I The sale items will be represented with an Entity Bean
J The sale items will be stored directly on a database
The explanation is as follows - Choices B, D, E, G and I are correct.
This question is really five mini questions.
If the business logic is put into the Servlet, you are creating Fat clients with presentation and business logic tightly coupled. Therefore, it is more appropriate to use a Stateful Session Bean especially since the Bean can be used in the Session Facade pattern (See below).
The site is an online auction site with bids being placed at different times. This implies that transactions will need to be handled at a very fine level of granularity therefore Bean Managed Transactions is the most appropriate choice.
The customer and sales items both need to be persisted so they should be implemented as Entity Beans. The Entity Beans (customer and sales items) would not be complicated objects so Container Managed Persistence would be the better choice.
Session Facade : A client should never "talk" directly to an Entity EJB. Instead, a Session to Entity pattern called a Session-Facade should be used. As the name suggests, this pattern is based on the GoF Facade pattern. The Session Facade provides a simple interface to a complex subsystem. The simple interface is the Session Bean and the Complex subsystem is the Entity Bean. The client talks to the Session Bean, which in turn communicates with the Entity Bean.
I'm not clear about the explanation. Do we always choose bean managed transactions when developing auction applications ? Are we expected to make this kind of subtle design decisions ? Morover entity beans do not support BMT. Can you please comment ?
Thanks
Devi
[ July 06, 2006: Message edited by: Sreedevi Vinod ]
[ July 06, 2006: Message edited by: Sreedevi Vinod ]