This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stateless and Stateful Session Beans

 
C Shinde
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has anyone used a Stateless Session bean as a Stateful Session beans with EJB 2.1 Spec?
If yes, how?
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C Shinde wrote:Has anyone used a Stateless Session bean as a Stateful Session beans with EJB 2.1 Spec?

Yes, a lot many applications use those.

C Shinde wrote:
If yes, how?

Not sure what you are looking for. Can you elaborate?
 
C Shinde
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.Well did you maintain state in DB, Server memory, like the EJBContext, and did you pass some context Id across to the client in response to every request from the client?
2. Why did you opt for using Stateless beans to maintain state and not continue using the right Stateful session beans?
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jaikiran Pai wrote:
C Shinde wrote:Has anyone used a Stateless Session bean as a Stateful Session beans with EJB 2.1 Spec?

Yes, a lot many applications use those.



OK, I am not fully awake yet! I read that question as "Has anyone used a Stateless Session bean and a Stateful Session beans with EJB2.1 spec?"

To answer your original question - No, using stateless session bean as a stateful session bean is not going to work out. If the application needs to maintain a state in the beans, then go for Stateful session beans. Any reason why you are trying to use SLSB when the usecase demands SFSB?
 
C Shinde
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

We surely have used Session beans to do Entity bean 'DB select' kind of activity with EJB 2.0. I dont remember if we had used stateful or stateless beans in this scenario and thats why the question came up.
I dont have any requirements, its just a question that came to my mind. An interview kind of an question say!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic