aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Is session is a strange thing? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Is session is a strange thing?" Watch "Is session is a strange thing?" New topic
Author

Is session is a strange thing?

jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
Dear all,

Please try to address the all points, I will be very helpful for me.if you found anything is wrong ,then guide me in proper way.


I am very confused about the idea of session, reason for this is I read many article so please do not ask me to refer any books or article.

Actually what are the use of session in any web application or distributed application.

1) How the data of a user is saved from other user�s interaction, to preserve the data from other users, It should be saved into session object?

2) stateless session and statefull session beans use session object to preserve data of a client

3) In any web application or distributed application, if data needed until the client quit from the application then where the data will be saved?, whether it is in session object?

4) As per my understanding only data are unique to a client over others. I explain it as follow

For example, in a interest calculator if client enter the amount and period then it will output the interest rate, when many users access the application and enters different data then output will vary for each users.

so data of each users should be saved. Please suggest how it is implemented in application

In stateless session bean ,what the "session" refers?.

Stateless bean does not maintain a conversational state for a particular client,then why it bear "session" in it.Why I can't say this as "Stateless bean" ?.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30780
    
157

1) Yes, it is saved in the session object.
2) No. Stateless session beans don't save any user state. Stateful session beans do store state, but not in the user session. At least not directly.
3) Yes. The session is a good spot for data like that.
4) Yes. You would want to put each user's data into their own session to avoid the scenario you described.

> In stateless session bean ,what the "session" refers?.
Nothing. A stateless session bean does not have a session. I don't know what the word "session" refers to there. It's an interesting question.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
In stateless session bean, what the "session" refers?.


There are two types of Session Enterprise JavaBean. One maintains "state" and the other does not maintain "state".

A user sits at a desk and uses a software application for 10 minutes. The user had a "session" with the application. During his/her session with the application, he/she executed some type of business logic in the application. The application's developer wrote the code that contains the logic in a "Session" EJB.

There are other types of Enterprise JavaBeans. There are "Entity" Enterprise JavaBeans and there are "Message-Driven" Enterprise JavaBeans. These other types of EJB are for different things other that handling business logic and user "sessions" with the application.

The word "Session" is an adjective that describes a certain type of Enterprise JavaBean. This helps distinguish it from the other types, e.g. Entity, Message-Driven.

The javax.servlet.http.HttpSession class and a Stateful Session Enterprise JavaBean are not the same. The "state" of a Stateful Session Enterprise JavaBean is not stored in a HttpSession object.

Hope this helps!
[ October 17, 2008: Message edited by: James Clark ]
jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
Thank you all,

The javax.servlet.http.HttpSession class and a Stateful Session Enterprise JavaBean are not the same


then please explain how session bean ,maintain its session?
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
then please explain how session bean ,maintain its session?


Stateful Session Enterprise JavaBeans do not maintain "session". They maintain "state", which is why they are described with the term "stateful".

The "state" is maintained by the EJB Container.
[ October 17, 2008: Message edited by: James Clark ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Is session is a strange thing?