Tuesday, June 16, 2009

EJB Session Beans

Session Beans in EJB

Session beans are Java components that run in either stand-alone EJB containers or EJB containers that are part of standard Java Platform, Enterprise Edition (Java EE) application servers. A Session bean represents a single client inside the J2EE server. To access the application deployed in the server the client invokes methods on the session bean. The session bean performs the task shielding the client from the complexity of the business logic.

These Java components are typically used to model a particular user task or use case, such as entering customer information or implementing a process that maintains a conversation state with a client application. Session beans can hold the business logic for many types of applications, such as human resources, order entry, and expense reporting applications.

Session bean components implement the javax.ejb.SessionBean interface. Session beans can act as agents modeling workflow or provide access to special transient business services. Session beans do not normally represent persistent business concepts.

Types of Session Beans:

There are two types of session beans, namely: Stateful and Stateless session beans.
Stateful session beans maintain conversational state when used by a client. Conversational state is not written to a database, it’s state that is kept in memory while a client uses a session.Maintaining conversational state allows a client to carry on a conversation with an enterprise bean.

Stateless session beans do not maintain any conversational state. Each method is completely independent and uses only data passed in its parameters.
A session bean corresponds to a client server session. The session bean is created when a client requests some query on the database and exists as long as the client server session exists.

1 comments:

righteous,  June 22, 2009 at 2:31 AM  

Here is a good tutorial on Java Beans. Excellent for starters

Blog Widget by LinkWithin

JS-Kit Comments

  © Blogger template Newspaper III by Ourblogtemplates.com 2008

Back to TOP