User development, A new message was posted in the thread "Stateful not keep data":
http://community.jboss.org/message/520556#520556 Author : Youssef El Maroufy Profile : http://community.jboss.org/people/elmaroufy Message: -------------------------------------------------------------- Hi I hope i'm in the correct sub-furum I have a problem with Stateful that do not keep data between methods calls; @Stateful public class ShoppingCart implements ShoppingCartLocal { private List<CartItem> cartItems; public List<CartItem> getCartItems() { return cartItems; } �...@postconstruct public void initialize() { System.out.println("<--Construct-->"); cartItems = new ArrayList<CartItem>(); } �...@predestroy public void clear() { System.out.println("<--Destroy-->"); 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 { �...@ejb ProductBusinessLocal productBusiness; �...@ejb ShoppingCartLocal shoppingCart; public List<CartItem> getCartItems(){ return shoppingCart.getCartItems(); } public ProductBusinessDelegate() { } } Thanks -------------------------------------------------------------- To reply to this message visit the message page: http://community.jboss.org/message/520556#520556
_______________________________________________ jboss-user mailing list [email protected] https://lists.jboss.org/mailman/listinfo/jboss-user
