JavaPolis 2005 – EJB 3.0

Aino Andriessen

While EJB 3.0 persistence gains a lot of attention we should not forget that EJB is more than persistence but also contains session beans and messaging driven beans. Mike Keith and Linda DeMichiel gave an excellent overview of the changes and improvements we can expect on these EJB’s. They explained that the driving force of EJB 3.0 is ‘ease-of-development’. While the current EJB’s are very powerfull they are also quite complex. Based upon Java metadata (annotations), dependency injection and on default, standard, usage we’ll get rid of the EBJ interfaces, the deployment descriptor and of the SessionContext in the code. This makes EJB’s much more like real POJO’s which results in cleaner, more comprehensible and better testable code.


For example:

import javax.ejb.Stateless.*;
* A simple stateless session bean implementing the incrementValue() method of the
* CalculateEJB interface.
public class CalculateEJBBean implements CalculateEJB {
int value = 0;
public String incrementValue() {
return "value incremented by 1";

Other improvements are the Enhanced Lifecycle Methods and Call Back Listeners: Instead of implementing the unnecessary callback methods like ejbActivate, ejbPassivate etc. any method can be designated to receive notifications for life cycle events. Another addition are Interceptors that are designed to intercepts a business method invocation.
EJB 3.0 will be backwards compatible and will support incremental migration.

Although the production release will be ready only until JavaOne, many vendors are already offering EJB 3.0 implementations.

More info:

Next Post

Three interesting announcements - EJB 3.0, Eclipse WTP and a new database: H2 (source included, Java)

Just browsing through my RSS feeds-reader, I stumbled across three very interesting announcements: JSR-220, the Enterprise JavaBean 3.0 specification, has reached Proposed Final Draft status. Programmers should expect that implementations should start to solidify now, although minor changes can still occur. It was predicted by Mike Keith in his presentation […]
%d bloggers like this: