Enterprise Java Beans

Enterprise Java Beans or EJB is a part of the JAVE EE API. To create an EJB, a Java class should import the following libraries:

import java.rmi.RemoteException;
import javax.ejb.*;

The concept of EJB is to standardize persistence, transaction and security in the back-end side of enterprise applications.

1. Stateless EJB – This is used for single method or single transaction only

2. Statefull EJB – Used for a full process transaction and the client should keep track of the state of the transaction. An example Bean would be a Bank Account and it’s states would be: Withdraw, Deposit, Close Account.

3. Message Driven Beans – an EJB triggered by a an external message, not from a method call

simple EJB example:
http://openejb.codehaus.org/hello-world.html

more examples:
http://docs.oracle.com/cd/E11035_01/wls100/ejb30/examples.html#wp1200448