• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Found this Question in the Mock exam. Can anybody tell/explain what the choice is...

 
veena madhukar
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
104 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?



A Have an Entity Bean to represent the customer. Use a Servlet to manage the users session and use BMT to manage the transactions.

B Have an Entity Bean to represent the customer. Use a Stateful Session Bean to manage the users session and use BMT to manage the transactions.

C Have an Entity Bean to represent the customer. Use a Servlet to manage the users session and use CMT to manage the transactions.

D Have an Entity Bean to represent the customer. Use a Stateful Session Bean to manage the users session and use CMT to manage the transactions.
 
Bobby Sh
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In continuation with this question.....
The answer given was : C and reason: 'The key to this question is the choice of Transactions Bean Managed Transactions or Container Managed Transactions. There is 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.....'

However, as company expects high volume of traffic. My understanding in such scenario we should have a stateful session bean [ container will maintain proper resource utilization using activation and passivation ]. So the answere should be

'D Have an Entity Bean to represent the customer. Use a Stateful Session Bean to manage the users session and use CMT manage the transactions.'

Any thoughts ???
 
arvindh seshadri
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?



A Have an Entity Bean to represent the customer. Use a Servlet to manage the users session and use BMT to manage the transactions.

B Have an Entity Bean to represent the customer. Use a Stateful Session Bean to manage the users session and use BMT to manage the transactions.

C Have an Entity Bean to represent the customer. Use a Servlet to manage the users session and use CMT to manage the transactions.

D Have an Entity Bean to represent the customer. Use a Stateful Session Bean to manage the users session and use CMT to manage the transactions.

My answer would be C . Because SSB are costly in resource management .Servlets are light weight and can very well accomplish the task .
 
Sreenivasa Majji
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a tricky question. You can go with either C or D. I Hope the real exam won't have this kind of twistings.
 
veena madhukar
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. Even i felt the answer could be either C or D. infact my choice wass D rather than C.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by veena madhukar:
Thanks. Even i felt the answer could be either C or D. infact my choice wass D rather than C.


"huge volume of traffic" ->
"Use a Servlet to manage the users session" vs "Use a Stateful Session Bean to manage the users session"

"High volume of traffic" suggests that you will use a server-cluster to handle the requests.
Application Servers can easily and readily migrate a Servlet Session from one server to another. This means that the cluster can more effectively balance the load of incoming requests.

Stateful Session EJBs: Beasts of Burden may be of some help. In particular:
Yes, many application servers provide SFSB replication of state to allow for failover of requests to provide a higher level of availability. SFSB replication is just that: a replication mechanism to resist failures of instances on a single machine. SFSB replication is not designed to resist cluster-wide failures nor is it designed to cache data across an entire cluster.

[ February 15, 2006: Message edited by: Peer Reynders ]
 
Sanjay Jadhav
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this about Stateless/Servlet Vs Stateful.

I would say here if you have single transaction which will be completed on single call i.e if your tansaction is going to compelte on single call from client then better to use stateless/servlet because there wont anything like conversational state, where as with stateful if you have number of call from single client and a single transaction not possible to complete on method call , then recommended to use stateful.

And I think resouce management is not about which one is heavy and which is not. You can get down your apps performance down by using stateless.

WizLab giving this "C", but Sun will say "C & D"
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sanjay Jadhav:
WizLab giving this "C", but Sun will say "C & D"


This question clearly pits the Servlet Session and the Stateful Session Bean against one another for "managing the users session". As the article outlines for that job the Servlet Session is superior - if you have access to one.

Once transactions get involved you have to use a session bean. It is preferable to use a Stateless Session Bean whenever possible. If you have a multi-step process that needs to be completed in a single transaction use a Stateful Session Bean. However watch the client usage profile. Only acquire the SFSB when you are ready to start the transaction and move through the steps as quickly as possible. Once the transaction has committed ditch the SFSB unless you are ready to immediately start and move through another transaction.
So, if possible, collect all the information you need from the user to move through the process in the Servlet Session before you start the transaction. If you can actually have ALL the information beforehand simply submit it in its entirety to a SLSB. If some of the information can only be discovered during the process gather as much as information from the user as possible in the Servlet Session before you get started, then complete the transaction in the fewest possible steps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic