Enterprise Java Bean (EJB) 3
An Enterprise Java Bean (EJB) is a server side managed J2EE (Java Enterprise Edition) component architecture for distributed, modular construction of enterprise application. EJB is based on RMI (Remote Method Invocation). Any Application Server can be used to deploy an EJB application. The following list is the popular application servers available -
- Oracle WebLogic Server
- JBoss Application Server
- WebSphere Application Server
- Glassfish Application Server
- Apache Geronimo Applications Server
- Apache TomEE
It is used to execute business logic and return a result without saving any client specific state information in server side e.g. Credit Card validation, do not maintain a conversational state for a particular client. It is not used for data persistence. It is best example of one to one communication between client and EJB component.
It is used to maintain client specific state e.g. session management at server side, shopping cart.The bean's state represents the interaction between the bean and a specific client. The Stateful Session Bean holds information about the client across method invocations.
It creates seperate component object for each client.
The Timer Service is used to develop time based enterprise application like; any source code to be executed in certain time interval. Ex- In shopping cart application if user does dot intract in certain time then EJB Container will ask password once again for conformation whether user is valid or not.
Interceptors is executed before and after the EJB method execution. Interceptors can be injected to Session Beans and Message Driven Beans. One or more interceptors can be applied to a bean. It can be applied Default, Class level and Method level.
The EJB 3.0 entity bean class is a non-abstract POJO class with implementation for the accessor/mutator (getter/setter) methods in comparison to the EJB 2.1 entity bean class, which is abstract with abstract accessor/mutator methods. EJB 3.0 does not require component and home interfaces.
The EntityManager class is used to create, find, and update an entity in EJB.
Java Messaging is a mechanism that lets programs to communicate with one another using Middle Oriented Middleware (MOM). The application can creating, sending, receiving, and reading message. The Java Messaging Service is a standard API for accessing Message Oriented Middleware.