[jboss-user] [EJB 3.0] New message: "Stateful not keep data"

Youssef El Maroufy do-not-reply at jboss.com
Mon Jan 18 06:41:19 EST 2010

User development,

A new message was posted in the thread "Stateful not keep data":


Author  : Youssef El Maroufy
Profile : http://community.jboss.org/people/elmaroufy

I hope i'm in the correct sub-furum
I have a problem with Stateful that do not keep data between methods calls;
public class ShoppingCart implements ShoppingCartLocal {
     private List<CartItem> cartItems;
     public List<CartItem> getCartItems() {
          return cartItems;
     public void initialize() {
          cartItems = new ArrayList<CartItem>();
     public void clear() {
          cartItems = null;

the method initialize() is executed on each call !
I'm using JBoss 5.1, and the Stateful is injected in a Managed Bean
public class ProductBusinessDelegate {
     ProductBusinessLocal productBusiness;
     ShoppingCartLocal shoppingCart;
     public List<CartItem> getCartItems(){
          return shoppingCart.getCartItems();
     public ProductBusinessDelegate() {



To reply to this message visit the message page: http://community.jboss.org/message/520556#520556

More information about the jboss-user mailing list