aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Sessions 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 "Sessions" Watch "Sessions" New topic
Author

Sessions

Aaron O'Brien
Ranch Hand

Joined: May 24, 2002
Posts: 89
Hi,
I am a little confused about sessions so if anyone has some info to share please pass it on!
Thanks in advance!
SCJP2


Aaron O'Brien
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
are you referring to session beans?? or.. what are you confused about?
cheers


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Long Huynh
Greenhorn

Joined: Jul 14, 2002
Posts: 7
Hi Aaron,
I'm assuming that you are referring to Session EJBs, since this forum is for J2EE and EJB. Well, from the top of my head, i can tell you that there are two main EJBs Session and Entity. Now, if we are taling about Session EJBs ( and not just a regular 'Session Bean'), then there are two other parts. There is the Stateful and Stateless Session EJBs. Basically, the Statefull has more overhead than the Stateless, over the network , because it has to remember states ( or carry data) as the client walk through certain webpages from the page that implicitly invoked or created the Stateful Session. Well, if you are asking when is best to use what? Well, ideally we would want so use stateless for all our needs. However, the stateless is good when you want to say invoke another page or update the current page with new data base on internal infomation or static links etc. But, if let say you need to retrieve data from the client from a series of say, 5 pages and then return the result base on what the user have given you. Well, the Statefull bean is useful here to help remember what the use had entered through those 5 pages, before you know what data to retrieve from the DB tier and calculate and return the results. However, this Statefull bean have to keep its states in the EJB pool (sorta like the String pool ) until it is no longer needed, and its states will reset for another use. If you want to know why we should use EJB Session instead of say the regular session, that's sorta another topic. But if you read up on EJB designs, you will notice that there is something like a regular session bean calling the EJB Session Beans or Entity Beans. Anyways, I hope this short and unprofessional introduction to EJB session was a little helpful.

Cheers,
Long Aaron Huynh
SCJP2
[ July 22, 2002: Message edited by: Long Huynh ]

Long A. Huynh ( yes, as in the primitive 64 bit Long...lol)<br />SCJP2<br />"Got Java?"
jesse harris
Ranch Hand

Joined: Oct 02, 2000
Posts: 62
.....and if you are asking about HttpSessions, they are a way for you to persist objects between servlet requests. a session is just a hashtable of objects kept by the app server for retrival. Very simple and useful as Servlets are shared by all requests that come in(usually), so thier class level variables are essentially static.
Aaron O'Brien
Ranch Hand

Joined: May 24, 2002
Posts: 89
Wow,
That was pretty helpful! Thanks alot...maybe any of you would have some URLs that would be useful for me to get farther in depth with this subject?! Thanks again!
Aaron SCJP2
 
 
subject: Sessions