2
votes

I am kind of new to EJB. I have understanding how HTTPSession is maintained (all cookies funda). All the resource in the internet says " Stateful Session Bean Maintenance session(remembers client). But I could not find answer to

How Stateful Session maintenance state ?

Oracle docs says

The state of an object consists of the values of its instance variables. In a stateful session bean, the instance variables represent the state of a unique client/bean session. Because the client interacts (“talks”) with its bean, this state is often called the conversational state.

Thanks.

1
No. I am sorry, this is not duplicate as in the other question has discussion about "stateless" bean. My question is about "stateful" bean.Malatesh
Not sure what link was given, but this question is definitely easier to understand if you really understand how stateless beans work (basically, in stateless beans, every method call doesn't necessarily refer the same instance, but this is not true for stateful beans).BalusC

1 Answers

1
votes

Instance is created when you first get a reference to the bean and you can only use this reference to maintain state through. Instance is destroyed when you call the method annotated with @Remove or the bean instance times out.

Source, the EJB JSR : download.oracle.com/otndocs/jcp/ejb-3.1-pfd-oth-JSpec. Chapter 4.6