Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

session bean, session bean instance and session object!!!

Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi folks,
could you please clearify the distiction in terms of their meaning among the terms session bean instance, session bean and session object? thanks.
Cowgirl and Author
Posts: 1589
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Usually, these three mean the same thing. Although sometimes when people use the word "bean", it means the entire component. In other words, if I say, "The ShoppingCart bean", I may mean the bean PLUS its interfaces.
Now, with entity beans, there IS a difference, although it is not always clear. The biggest issue is when someone says (including the spec), "An entity bean survives a server crash." Clearly, there is NO way that an object can survive the crash. So the entity *instance* dies, but the entity bean is considered "alive" simply because the entity is STILL in the underlying persistent store AND the bean type is still deployed. In other words, an entity bean is said to exist EVEN WHEN NO ENTITY OBJECT/INSTANCE IS CURRENTLY REPRESENTING THAT ENTITY. If it is *possible* for an entity bean to come out of the pool and BE that particular entity, then the entity bean is said to exist. So an entity BEAN can exist even if an entity instance does not yet exist in the pool, as long as the container is able to create a bean instance and then populate it with that particular entity's data.
Usually the term instance and object are used to mean the same thing... an instance/object on the HEAP. The term "bean" does not always imply an instance/object on the heap, although with session beans, the spec does use those terms interchangeably, and there is no difference really in talking about a bean vs. an instance, unless you are referring to the bean as the component. "I made a session bean" or "I deployed a session bean" means I deployed a component of that type into the server, but that does not mean the same thing as an instance and object.
Really, the only time I think these terms matter is with entity beans. Where you must know, for example, that when an ENTITY BEAN dies (through an ejbRemove()), the entity INSTANCE does NOT die, but instead goes back to the pool as a still living, breathing, on-the-heap object. An entity bean INSTANCE does not die until the server calls unsetEntityContext(), or the bean throws a system exception, or the server crashes.
I probably just made it more confusing
Brian Smith
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the respons, Kathy.
But i still need to make it clear here. Let's look at the following line from the Spec, page 55 under the Overview in the 2nd paragraph where it says, A Client accesses a SESSION OBJECT through the SESSION BEAN's component interface.
Do the *session object* and *session bean* mentioned above mean SAME thing?
Are those term refering to *AdviceBean* in the case of HF EJB example?
if i say session bean instance, does this refer to the *AdviceBean* class?
could you please make it clear to me? I don't know what is my source of confusion!
[ December 23, 2003: Message edited by: Namaste Sathi ]
    Bookmark Topic Watch Topic
  • New Topic