Hi all.

i've a problem with ejb stateful bean.

in my stateful ejb i've this method

@Stateful
public class ShopCartBean implements ShopCartLocal {

   @EJB
   private MGMTLocal man;




   private Customer customer;

   public boolean *enableShopping*(String user, String password) {
       customer  = man.loginUser(user, password);
       if (customer  != null) {
           return true;
       } else {
           return false;
       }
   }

 public boolean *addItem*(int idItem, int quan) {
       if (customer != null) {
                 ......
       } else {
           System.out.println("no customer");
           return false;
       }
   }

}

i've an action that perform the login and has to set customer corrisponding
class

    @InjectEJB(name = "WAP-Shop/ShopCartBean")
    private ShopCartLocal scb;

....


  if (scb.*enableShopping*(username_login, password_login)) {
               return SUCCESS;
           } else {
               return ERROR;
           }

this action return success OK.

now, i call another class

    @InjectEJB(name = "WAP-Shop/ShopCartBean")
    private ShopCartLocal scb;

if (scb.*addItem*(idItemtoAdd,quantity)) {

                    return SUCCESS;
                } else {
return ERROR;
}

this action return ALWAYS ERROR: Customer is always set to NULL.
stateful usaually doesn't store information?
or i miss something?
-- 
Stefano

Reply via email to