geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purdticker <>
Subject Re: geronimo newbie - stateful session bean
Date Mon, 14 Jan 2008 21:10:02 GMT

I just read this from the original link you gave me:
"As in EJB 2.x, invocations on the same reference to a stateful session bean
are handled by the same EJB instance, making it important to store this
reference in a location that can be repeatedly read by the client. In the
case of the music store, this reference is stored in the user's

I suppose my counter is only showing 1 because all I'm doing is creating new
instances over and over?  I thought geronimo was supposed to handle this
automatically?  Perhaps I'm mistaken.  So should I store this variable in
the "session" variable in the jsp?

Cedric Hurst wrote:
> purdticker wrote:
>> I'm trying to create a simple stateful session bean that keeps a counter.
>> Every time I refresh the page, I want the counter to increase by 1.  When
>> someone ELSE visits the page, I want it to start off on 1 for them.  In
>> other words, the counter should be specific to the user's personal
>> session.
>> I've tried following this tutorial
>> except I using @Stateul.  But when I do that it just always says 1.
>> Can anyone point me in the right direction?  A tutorial perhaps?
> Hi,
> You might want to take a look at the MusicStore example listed here:
> Specifically, take a look at the class.  It uses the
> @Stateful annotation.  
> There's also a more complicated example in the
> class from Chapter 3 of "EJB 3 in Action" by Manning Press:
> The source code for the book is available for download.  Tthere's no
> specific example for Geronimo, but the bean code should be JEE 5
> universal.
> If you're still having trouble, feel free to post a zip file of your
> project.  I'd be happy to take a look.

View this message in context:
Sent from the Apache Geronimo - Users mailing list archive at

View raw message