Hi,
Referring to Qn.8 of mock exam #3 from JavaQueries.com (same as Qn.104 at http://www.geocities.com/subra_73/SCEA_Practice_Questions.htm), which is also reproduced below, I'm wondering why servlets should be used instead of stateful session beans. Aren't the latter better to address the requirements? Moreover, if servlets can be used this way, then what is the point in having stateful session beans? Or is this one of those problematic questions?
--- Start ---
You are developing an online shopping store for an art gallery. The company aims to bring fine art to the masses and expects a huge volume of traffic through the site. The site allows customers to pay for goods and arrange delivery methods using credit cards. You have read through the requirements and have a rough design in your head. Which of the following is the most appropriate rough design for this site?
AHave an Entity Bean to represent the customer. Use a Servlet to manage the users session and use BMT to manage the transactions.
BHave an Entity Bean to represent the customer. Use a Stateful Session Bean to manage the users session and use BMT to manage the transactions.
CHave an Entity Bean to represent the customer. Use a Servlet to manage the users session and use CMT to manage the transactions.
DHave an Entity Bean to represent the customer. Use a Stateful Session Bean to manage the users session and use CMT to manage the transactions.
Choice C is correct.
The key to this question is the choice of Transactions: BMT or CMT. There is no need to control transactions at a fine level of granularity and Entity Beans cannot take part in BMT. Hence CMT may be a better choice. The Servlet is a more appropriate choice for handling the users session however you would still need another Stateful Session Bean for the business logic of the application.
--- End ---
Thanks in advance,
Dhanan.