|Home > Documentation > Developing > Tutorials > Developing EJB applications|
Enterprise JavaBeans (EJB) is a platform for developing reusable and portable Java applications. In very simple terms we can say that EJB is a Java code that runs in a runtime environment called EJB container.
EJB has three different types of components: Session beans, Message Driven Beans and Entity bean. Session beans and Message Driven Beans are used for developing the business logic and Entity beans are used for persistence.
EJB provides the following services: transactions, persistence, state management, messaging, security and many more. EJB can be considered as a framework because of the components and services they provide for enterprise application development.
This document is organized in the following sections:
EJB2 was quite complex for developers. It involved a lot of code-home interface, remote interface, local interface, bean class and deployment descriptors. Also you have to write lots of bean classes which are never called, but are required by the bean class to implement the interface. You need to implement life cycle callback methods likes ejbCreate, ejbRemove, ejbActivate, ejbPassivate compulsorily even if those are not required. Also many object oriented features such as inheritance, polymorphisms were not supported by EJB2.
EJB3 as against to EJB2 has undergone a great change. The hard work and innovations from the community has simplified EJB development to a great extent. In EJB3, classes are nothing but a simple Plain Old Java Object(POJO) and interfaces are Plain Old Java Interfaces(POJI). EJB3 objects are plain Java object which are given special powers with Annotations. A POJO plus Annotation is nothing but a EJB3 object. EJB3 is one of the best framework available for server side development due to the following reasons:
We sill discuss each of these in upcoming sections and EJB applications.
There are three different types of beans as was discussed earlier:
We will discuss each type of Bean one by one.