Here you will understand the basics of EJB. JEE technology from Sun Microsystems( now purchased by Oracle corporation ) is used to build multi tier applications up to enterprise level.This is a standard which is provided by the containers complying with the standards. Containers are capable of providing functionalities like transaction management ,caching, clustering, managing sessions, messaging between applications etc.
In this tutorial, we provide the sample based on the JBOSS server.
EJBs are basically classified into Session beans, Entity beans and Message driven beans.
Session beans are basically used across applications and are the most popular and widely used among the three. There are two kinds of session beans namely – Stateful session beans and Stateless session beans.
A Stateful session bean is mainly used in shopping cart where you need the state of the session to be maintained till the shopping is done. On checkout the session is disposed.
A stateless bean is a class that is lived for short span. You mainly use that in managing transaction at enterprise level. Basically any CRUD operations can be done using the stateless bean. There is no need to instantiate the class every time you need that as the application server passes the instance from a pool.
Message beans provide are used to implement the messaging function in your application logic. When you want to send message to one or more applications, message driven beans can be used. Message beans provide the facility for acknowledgement as well. This can be used in the chat applications.