Enterprise Java Beans (EJBs) are server-side managed classes intended to provide business functionality to applications. Since Java EE 5, EJBs have been made much simpler and more lightweight.
EJBs no longer have to be defined by XML descriptors, but are defined using Java annotations instead. This allows EJBs to be developed more quickly and probably more importantly, to be fully testable outside of the application server.
In Java EE 7, there are four types of EJB. They are Stateless, Stateful, Singleton, and Message Driven EJBs. J2EE also had Entity beans used for modeling data, but these have been deprecated since Java EE 5 to be replaced with POJOs and JPA.
Stateless EJBs, as their name suggest, maintain no state. When a request ...