A developer writes two session beans which cooperate. The first session bean, ShoppingCart,
collects orders and is implemented as a stateful session bean. The second session bean,
CalculateDiscount, is implemented as a stateless session bean and runs on a different server.
ShoppingCart contains the method getTotalPrice, which calculates the total price of the order in
the ShoppingCart, including discounts. Discounts are calculated by CalculateDiscount using the
information on the ShoppingCart bean, combined with data from a database. Which scenario can
accomplish this?
A.
The CalculateDiscount offers a method calculate which is invoked by the ShoppingCart bean
passing the this reference.
B.
The CalculateDiscount offers a method calculate which is invoked by the ShoppingCart bean.
CalculateDiscount accesses the ShoppingCart instance by JNDI lookup.
C.
The CalculateDiscount offers a method calculate which is invoked by the ShoppingCart bean
passing its reference obtained from the SessionContext.getBusinessObject method.
D.
The CalculateDiscount offers a method calculate which is invoked by the ShoppingCart bean.
CalculateDiscount accesses the state of ShoppingCart by dependency injection.
Explanation: