javaejbsession-bean

Why session beans are called so?


As I see in examples, every java class can be defined as a session bean in ejb, even if there is no http session defined and used inside them. So, why are they called session beans?


Solution

  • A session bean performs operations, such as calculations or database access, for the client. . Session bean objects either can be stateless or can maintain conversational state across methods and transactions.

    A stateless session bean is an object that does not have an associated conversational state, but may have instance state

    In Stateful session bean, the instance variables represent the state of unique client-bean sessions. The interaction of the client with bean is called as conversational state.

    No matter whether a session bean is statelss or stateful they mantain some kind of session, which may last for a single call or may last for mulitple bean calls. Hence they are called Session beans.