Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 40248 invoked from network); 12 Oct 2009 19:51:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Oct 2009 19:51:34 -0000 Received: (qmail 73054 invoked by uid 500); 12 Oct 2009 19:51:33 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 72987 invoked by uid 500); 12 Oct 2009 19:51:32 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 72979 invoked by uid 99); 12 Oct 2009 19:51:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Oct 2009 19:51:32 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [209.85.217.209] (HELO mail-gx0-f209.google.com) (209.85.217.209) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Oct 2009 19:51:30 +0000 Received: by gxk1 with SMTP id 1so10951245gxk.19 for ; Mon, 12 Oct 2009 12:51:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.101.191.1 with SMTP id t1mr5931317anp.67.1255377068380; Mon, 12 Oct 2009 12:51:08 -0700 (PDT) In-Reply-To: <25861132.post@talk.nabble.com> References: <25861132.post@talk.nabble.com> From: Quintin Beukes Date: Mon, 12 Oct 2009 21:50:48 +0200 Message-ID: <1f3854d50910121250p43f9b28n4fe192de12242f3f@mail.gmail.com> Subject: Re: Stateful session bean has no state To: user@geronimo.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Are you storing your session bean instance in the servlet/JSP session conte= xt? Quintin Beukes On Mon, Oct 12, 2009 at 8:48 PM, Antonio Forni=C3=A9 wrote: > > Hello again! > > I made a stateful sessiob bean and it's working the same way my stateless > beans do: they forget their state. Here's my code: > > @Stateful > public class CartBean implements CartLocal { > > =C2=A0 =C2=A0 =C2=A0 =C2=A0private Integer number =3D new Integer(0); > > =C2=A0 =C2=A0 =C2=A0 =C2=A0public void setNumber(Integer number) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0this.number =3D nu= mber; > =C2=A0 =C2=A0 =C2=A0 =C2=A0} > > =C2=A0 =C2=A0 =C2=A0 =C2=A0public Integer getNumber() { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return this.number= ; > =C2=A0 =C2=A0 =C2=A0 =C2=A0} > > =C2=A0 =C2=A0 =C2=A0 =C2=A0@Override > =C2=A0 =C2=A0 =C2=A0 =C2=A0public Integer getNumberService() { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0this.number +=3D 1= 0; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return this.produc= tNumber; > =C2=A0 =C2=A0 =C2=A0 =C2=A0} > > } > > My jsp uses CartLocal interface wich only shows "getNumberService()" meth= od. > When requesting the jsp with my web browser it always shows ten. when > refreshing the page it should show 20, but once again shows 10. What am I > doing wrong? > > Thank you very much! > -- > View this message in context: http://www.nabble.com/Stateful-session-bean= -has-no-state-tp25861132s134p25861132.html > Sent from the Apache Geronimo - Users mailing list archive at Nabble.com. > >