JavaPolis 2005 – EJB 3.0

0

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.
 */
@Stateless(name="CalculateEJB")
public class CalculateEJBBean implements CalculateEJB {
    int value = 0;
    public String incrementValue() {
        value++;
        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:

Share.

About Author

Aino Andriessen is a consultant on Enterprise Java, ADF, PL/SQL, XML, and SOA development and is Expertise Lead on Application Lifecycle Management (ALM). He has a strong interest in ADF, SOA, Maven, architecture, quality management, delivery and application lifecycle management. Aino publishes on the AMIS technology blog and has been a presenter at the ODTUG Kaleidoscope, Oracle Open World and UKOUG TechEbs.

Comments are closed.