aspose file tools*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Doubt about another mock exam question 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 "Doubt about another mock exam question" Watch "Doubt about another mock exam question" New topic
Author

Doubt about another mock exam question

Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643
Question1

You are designing an online cinema ticket booking application. At the moment you plan to have a controller to maintain user sessions, a customer component to hold personal details, a credit card validation component, a set of GUI screens and a cinema component with details of all movies and seating capacities. What should be used for each component?

A The controller should be a Stateful Session bean. The customer should be a Stateful Session bean. The cinema component should be a Stateful Session bean. The credit card validation component should be an Entity bean.
B The controller should be a Servlet. The customer should be a Stateful Session bean. The cinema component should be a Stateful Session bean. The credit card validation component should be an Entity bean.
C The controller should be a Stateful Session bean. The customer should be a Servlet. The cinema component should be a Stateful Session bean. The credit card validation component should be a Stateful Session bean.
D The controller should be a Servlet. The customer should be a Servlet. The cinema component should be a Stateful Session bean. The credit card validation component should be a Stateful Session bean.
E The controller should be a Stateful Session bean. The customer should be an Entity bean. The cinema component should be an Entity bean. The credit card validation component should be a Stateless Session bean.
F The controller should be a Servlet. The cinema component should be a Stateful Session bean. The cinema component should be an Entity bean. The credit card validation component should be a Stateless Session bean.
G The controller should be a Stateful Session bean. The customer should be an Entity bean. The cinema component should be an Entity bean. The credit card validation component should be a Stateless Session bean.
H The controller should be a Servlet. The customer should be an Entity bean. The cinema component should be an Entity bean. The credit card validation component should be a Stateless Session bean.
I Make the GUI using JSP pages
J Make the GUI an applet

Correct optionsare H and I.

According me Correct options should be E And I

My doubt is In above case how will i decide between servlets and statefull session beans for controller.

Please help
Thanks
Ådne Brunborg
Ranch Hand

Joined: Aug 05, 2005
Posts: 208
Originally posted by Gowher Naik:

E The controller should be a Stateful Session bean. The customer should be an Entity bean. The cinema component should be an Entity bean. The credit card validation component should be a Stateless Session bean.

H The controller should be a Servlet. The customer should be an Entity bean. The cinema component should be an Entity bean. The credit card validation component should be a Stateless Session bean.

My doubt is In above case how will i decide between servlets and statefull session beans for controller.


A short answer: Ask yourself the question, "Do I need the functionality of a shopping cart?" If yes, you can use a stateful session bean. Here, you don't.

Also: You will need a Servlet to act as a Controller for the JSP-pages. You cannot have JSP talking directly to a Stateful SB.

The idea here is obviously exposing the Entity beans to the Servlet. This is not to be recommended in Real Life.

For an application like this, I would use a stateless session bean, and never ever under any circumstances expose entity beans to anything but a session bean, if even that. The very idea of exposing entity beans (the EIS Integration tier) to the servlet (the Web tier) is bad, bad, bad.

Sorry, I'm ranting...

A better answer would be
K The controller should be a Servlet and a Stateless Session bean. The customer should be an Entity bean. The cinema component should be an Entity bean. The credit card validation component should be a Stateless Session bean.


Entia non sunt multiplicanda praeter necessitatem
Juan Pablo Crossley
Ranch Hand

Joined: Oct 16, 2007
Posts: 128
the previous answer is perfect... I want to include if you have a stateful you will need to put the remote object in an session variable, in order to get it and do the next step, but the JSPs are not the best components to have code like Remote object creation (or local) and execute, etc. you will have more business code in your JSP than you should.

If you are asked to control your application flow you will choose a Servlet because it's part of the MVC components, the Stateful are components to be used as business layer (or at least as business front), it should not drive your application flow, or control your screens (that's a controller responsibility).


SCJP, SCBCD, SCEA 5, MCP

How to pass SCEA 5 | 2, 3, N-tier which one should I pick? | Analysis of persistence layer from SCEA 5 perspective | Swing... why not?
 
jQuery in Action, 2nd edition
 
subject: Doubt about another mock exam question