Session Bean

What Does Session Bean Mean?

A session bean represents a single Java Platform 2, Enterprise Edition (J2EE) server application, which handles business tasks for its client inside the server.


When a user and computer exchange a dialog, an interactive session occurs. A session bean resembles an interactive session in that a session bean has only one client. After a client terminates, the session bean also ends, as does the relationship between the session bean and the client.

Techopedia Explains Session Bean

When a client accesses a server application, the client session bean begins. After the client stops, the session bean stops and is no longer related to the client. Stateful session beans and stateless session beans are the two types of session beans.

Stateful session bean instance variables, which indicate the state of the client-bean interaction, are retained for the client-bean interaction period. The state is no longer retained when interaction ends. Stateless session bean instance variables (those containing the state of the session) are retained as long as the method is invoked. The state is not retained for the entire session duration.

There are two critical circumstances where session beans should be used. One is when only one client will be accessing a bean instance during a particular period of time. The second is when the state of the bean need not remain persistent, meaning it will only last a few hours.


Related Terms

Margaret Rouse
Technology Expert

Margaret is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.