States need to be maintained between calls. In EJB3 all beans are homeless [no home interface]//ShoppingCartBean.javaimport java.io.Serializable;import java.util.HashMap;import javax.ejb.Remove;import javax.ejb.Stateful;import javax.ejb.Remote;@Stateful@Remote(ShoppingCart.class)public class ShoppingCartBean implements ShoppingCart, Serializable{ private HashMap cart = new HashMap(); public void buy(String product, int quantity) { if (cart.containsKey(product)) { int currq = cart.get(product); currq += quantity; cart.put(product, currq); } else { cart.put(product, […]

Read more of this post