EJB stateful vs stateless
I have been studying Java EE and I posted a question on Stackoverflow to verify my understanding of “SessionBean”, here is the summary: Stateless bean in client:
1 2 3 4 5 |
public void work(){ bean.work1(); // this uses instance 1 in App Server ... bean.work2(); // this can be instance 2 in App Server } |
Stateful bean in client:
1 2 3 4 5 |
public void work(){ bean.add_item(item); // this uses instance 1 in App Server .... bean.checkout(); // this uses instance 1 in App Server } |
A stateless session bean, should not store a state in the bean instance, in order words, it’s class members should… Read More »