Enterprise Application Development using EJB Innovation

Enterprise Application Development using EJB Innovation

COURTESY :- vrindawan.in

Wikipedia

Jakarta Enterprise Beans (EJB; formerly Enterprise Java Beans) is one of several Java APIs for modular construction of enterprise software. EJB is a server-side software component that encapsulates business logic of an application. An EJB web container provides a runtime environment for web related software components, including computer security, Java servlet life cycle management, transaction processing, and other web services. The EJB specification is a subset of the Java EE specification.

Creating an Enterprise Application with EJB 3.1

The EJB specification was originally developed in 1997 by IBM and later adopted by Sun Micro systems (EJB 1.0 and 1.1) in 1999 and enhanced under the Java Community Process as JSR 19 (EJB 2.0), JSR 153 (EJB 2.1), JSR 220 (EJB 3.0), JSR 318 (EJB 3.1) and JSR 345 (EJB 3.2).

The EJB specification provides a standard way to implement the server-side (also called “back-end”) ‘business’ software typically found in enterprise applications (as opposed to ‘front-end’ user interface software). Such software addresses the same types of problem, and solutions to these problems are often repeatedly re-implemented by programmers. Jakarta Enterprise Beans is intended to handle such common concerns as persistence, transactional integrity and security in a standard way, leaving programmers free to concentrate on the particular parts of the enterprise software at hand.

The EJB specification details how an application server provides the following responsibilities:

  • Transaction processing
  • Integration with the persistence services offered by the Jakarta Persistence (JPA)
  • Concurrency control
  • Event-driven programming using Jakarta Messaging (JMS) and Jakarta Connectors (JCA)
  • Asynchronous method invocation
  • Job scheduling
  • Naming and directory services via Java Naming and Directory Interface (JNDI)
  • Interprocess Communication using RMI-IIOP and Web services
  • Security (JCE and JAAS)
  • Deployment of software components in an application server

Additionally, the Jakarta Enterprise Beans specification defines the roles played by the EJB container and the EJBs as well as how to deploy the EJBs in a container. Note that the EJB specification does not detail how an application server provides persistence (a task delegated to the JPA specification), but instead details how business logic can easily integrate with the persistence services offered by the application server.

Businesses found that using EJBs to encapsulate business logic brought a performance penalty. This is because the original specification allowed only for remote method invocation through CORBA (and optionally other protocols), even though the large majority of business applications actually do not require this distributed computing functionality. The EJB 2.0 specification addressed this concern by adding the concept of local interfaces which could be called directly without performance penalties by applications that were not distributed over multiple servers.

The EJB 3.0 specification (JSR 220) was a departure from its predecessors, following a new light-weight paradigm. EJB 3.0 shows an influence from Spring in its use of plain Java objects, and its support for dependency injection to simplify configuration and integration of heterogeneous systems. EJB 3.0 along with the other version of the EJB can be integrated with MuleSoft-v4 using MuleSoft certified PlektonLabs EJB Connector. Gavin King, the creator of Hibernate, participated in the EJB 3.0 process and is an outspoken advocate of the technology. Many features originally in Hibernate were incorporated in the Java Persistence API, the replacement for entity beans in EJB 3.0. The EJB 3.0 specification relies heavily on the use of annotations (a feature added to the Java language with its 5.0 release) and convention over configuration to enable a much less verbose coding style. Accordingly, in practical terms EJB 3.0 is much more lightweight and nearly a completely new API, bearing little resemblance to the previous EJB specifications.

Enterprise Java Beans is a framework that allows one to develop Enterprise applications more easily using Java Enterprise Edition. It does this by using standard components. These components specify how an application works. This is usually called business logic.

There are different kinds of Beans:

  • Session beans help to implement the main business logic. They are either State ful (remembers things), Stateless (remembers nothing) or Singleton (only one of those exists). An example of a session bean might be the piece of code that tells how to store items in a database.
  • Message-driven beans allow a system to work asynchronously. They help to make different systems talk to each other by sending messages. Sometimes they are used to talk to legacy systems.