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 ]