This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Stateless and Stateful Session Beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Stateless and Stateful Session Beans" Watch "Stateless and Stateful Session Beans" New topic
Author

Stateless and Stateful Session Beans

C Shinde
Ranch Hand

Joined: Oct 22, 2009
Posts: 60
Has anyone used a Stateless Session bean as a Stateful Session beans with EJB 2.1 Spec?
If yes, how?


Regards,
Chetan Shinde
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9912
    
158

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?

[My Blog] [JavaRanch Journal]
C Shinde
Ranch Hand

Joined: Oct 22, 2009
Posts: 60
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

Joined: Jul 20, 2005
Posts: 9912
    
158

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

Joined: Oct 22, 2009
Posts: 60

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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stateless and Stateful Session Beans
 
Similar Threads
Why Stateless session beans does't maintaining any conversational state?
Session Bean pooling
Create method in entity and session bean
concurrent access?
Design Decision help needed