petsore session facade question


EJB design: petsore session facade question

  1. petsore session facade question (1 messages)

    Hello again,

    I'v been studying the petstore example and their is one thing I don't understand very well.
    They use a ShoppingClientFacade with a Local interface like this :

    public interface ShoppingClientFacadeLocal extends EJBLocalObject {

        public ShoppingCartLocal getShoppingCart();
        public void setUserId(String userId);
        public String getUserId();
        public CustomerLocal getCustomer() throws FinderException;
        public CustomerLocal createCustomer(String userId);


    I was always thinking that one of the aims of a session facade was to give the web tier one entrance to enter de ejb-tier. But this example has methods like getCustomer and getShoppingCart, which returns Customerbeans and ShoppingCartbeans to the webtier. So if you are in the web tier and connect to the sessionfacade ShoppingClientFacade, you can call a method like getCustomer(), and then you get a direct reference to your CustomerBean, so the web tier doesnt has to use the session facade anymore, because you can directly acces the customerbean. Why is that done that way? I assume their is a good reason, but I don't see which one....

    Can somebody explain this please????????

    Thanx in advance,

  2. petsore session facade question[ Go to top ]

    You have to take note that this facade ejb resides on the application tier, and besides providing a common interface to the ejb tier, its other purpose is to hold conversational state. Also take note that the interfaces are local, which means that these objects are managed locally, and cannot be remotely referenced.