Difference Between EJB 2.1 and EJB 3.0

 EJB 2.1 vs EJB 3.0

The major transition from the EJB 2.1 to the EJB 3.0 was mainly centered on performance in terms of speed and output and simplicity. Its modification would center on how the new program would work with other programmers like the Java EE5.

From an application of EJB 2.1 to the new EJB 3.0 Architect, it can be correct to state that the improved version stands as an answer to the earlier shortcomings of the then EJB 2.1.

Let us look at some of the major transitions.

Simplicity

The EJB 3.0 offers simplicity in manipulation of contents, which is perhaps one of its major outstanding factors. Unlike the EJB 2.1 you can now create an Enterprise Java Bean application with a lot of simplicity.

This is so because the EJB 3.0 operation is based on Plain Old Java Object (POJO) programming configuration that apprehends data by use of Java annotations that was contained by the deployment descriptors. In most cases deployment descriptors are least required.

As opposed to the EJB 2.1 that requires noting down more supporting codes, the opposite is true when using the EJB 3.0 components which shall require you to jot and keep fewer supporting codes thus offering the most simplified experience in programming.

Effectiveness

It is stated that the new EJB 3.0 is approximately 45% more effective as compared to the EJB 2.1. This is attributed to the major modifications to the EJB 2.1 as explained below.

Replacement of the DTD that identified the ejb-jar.xml arrangement descriptors by the modified xml schema and also an improved way of producing enterprise beans has rendered the EJB 2.1 undesirable to work with. The introduction of Plain Old Java Object bases quintessence through the Java persistent API.

While the introduction of session beans altered the added reinforcement for internet service, EJB 3.0 has introduced featherweight entity bean endurance functioning. These entities are Plain Old Java Object based and require neither the EJB codes running in them nor an interface. Furthermore, they can work outside an EJB container

Specifications

When EJB 2.1 required that the constituent interface surpass that from the EJB structure, they are now written as Plain Old Java Objects when using EJB 3.0, which manifest Plain Old Java Interface and thus require not the home interface.

Introduction of improved methods like use of metadata annotations and other mechanisms used to create the Java codes and XML descriptors, unlike the EJB 2.1 distribution descriptors that were cumbersome and inaccurate.

The EJB 2.1 application required the J2EE container to postulate the services needed to work the EJB accurately and thus rendered them difficult to test. JNDI is frequently depended on in EJB 2.1 when using applications is monotonous and time consuming.

EJB 3.0 does not require specific interface and descriptors allocations. This is because the annotations possess as a suitable replacement for the allocation descriptors. You are able to use default values more often when using the EJB 3.0 application as opposed to the EJB 2.1. The EJB 3.0 offers less checked inconsistency enabling creativity.

Summary

The EJB 3.0 in the new transition from the EJB 2.1.

It is easy to work with the EJB 3.0 as opposed to the EJB 2.1 version.

The EJB 3.0 uses entities that are mainly Plain Old Java Object (POJO) based.

EJB 2.1 requires noting down more supporting codes as compared to the EJB 3.0 that reduces the number of supporting codes.

The DTD in the EJB 2.1 is replaced by the modified XML Schema in the EJB 3.0.

Java codes are easily generated by the improved applications in the EJB 3.0 unlike in the EJB3.1 where the process is much difficult.