What are the additional features of EJB 2.1 over EJB 2.0

Alessandro A. Garbagnati

Compared to the 2.0 specifications, EJB 2.1 have focused the attention in trying to be more "web-services" oriented, and with the improving of some important features where the community have found some design or implementation issue, like the Query Language, the addition of a Timer service, and other improvement like Message-Driven Beans.

Everybody has noticed that the biggest addition in EJB 2.1 is the new support for the Web-Services technology. With this new specifications, in fact, developers can expose their Stateless Session and Message-Driven EJBs as Web Services based on SOAP. This will mean that any client that complies with SOAP 1.1 will be able to access to the exposed EJBs. The APIs that will allow this and that have been added, are JAXM and JAX-RPC.
The first one, JAX-RPC, stands for Java API for XML-RPC, and it can be considered as Java RMI, but unsing SOAP as the protocol.
The second one, JAXM, stands for Java API for XML Messaging, and it is a SOAP messaging API similar to JMS (Java Message Service). JAXM is an API for sending and receiving messages via Web services, conceptually similar to JMS that is an API for sending and receiving messages via message-oriented middleware.

Another addition is the Timer Service, that can be seen as a scheduling built right inside the EJB Container.
With EJB 2.1, any Stateless Session or Entity Bean can register itself with the Timer Service, requesting a notification or when a given timeframe has elapsed, or at a specific point in time.
From a developer point of view, the Timer Service uses a very simple programming model based on the implementation of the TimedObject interface.

From the enhancement side, the Query Language is definitely the topic where the improvements are definitely more visible.
The ORDER BY clause has finally been added. This will improve performance on orederd queries, because this will be handled by the underneath database, and not through the code by sorting the resulting collection.
The WHERE clause has been improved with the addition of MOD, while the SELECT clause has been improved by adding aggregate functions, like COUNT, SUM, AVG, MIN and MAX.

Other enhancements can be noticed on the Message-Driven Beans or the Destination Linking.

Additional information can be found at the Enterprise JavaBeans official page at Sun.