[jboss-user] [EJB 3.0 Users] - Re: Stateful session beans don't keep state !!!
Wolfgang Knauf
do-not-reply at jboss.com
Thu Oct 8 05:59:34 EDT 2009
Hi,
according to your code comments, you call "setShippingInfo", then a new instance of your OrderItemBean is created, and after this "setBillingInfo" is called.
This cannot work with a Stateful bean, because you will get a new, clean instance on each lookup. The state will only be kept if you save it in some member variable.
To work around this you might place the EJB in the session (or in the request):
HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false;
| session.setAttribute("myPlaceOrder", placeOrder);
Later, you can reuse the "placeOrder" instance by reading it from the HttpSession.
Hope this helps
Wolfgang
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4259314#4259314
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4259314
More information about the jboss-user
mailing list