EAServer EJB support  EJB 1.1 differences from EJB 1.0

Chapter 6: Enterprise JavaBeans Overview

EJB 2.0 differences from 1.1

EJB 2.0 introduces support for message driven beans, new home interface method syntax, local interfaces, and inter-vendor interoperability. EJB 2.0 also enhances the container managed persistence model defined in EJB 1.1.

Message-driven beans

EJB 2.0 integrates the EJB component architecture with the Java Message Service (JMS) asynchronous messaging API. EJB 2.0 allows you to define message-driven bean (MDB) components to respond to JMS messages. An MDB component is similar to an EJB stateless session bean, but the MDB component responds only to JMS messages and has no direct client interface.

For information on JMS, see Chapter 31, “Using the Message Service.” For information on creating MDB components, see “Message-driven beans”.

Home interface methods

EJB 2.0 allows you to define business methods in the home interface for an entity bean and changes the syntax of create methods.

Create method syntax

Previously, create methods were restricted to methods named create. In EJB 2.0, you can use any name that begins with create, such as createNewAccount.

Home interface business methods

You can add business methods to the home interface for an entity bean to perform operations that are not specific to a single instance. For example, a home business method might return the average employee salary. For each home business method, the entity bean’s implementation class must have a method with the same name, except for the prefix ejbHome, and the same signature. For example, if the home interface declares:

public double averageSalary();

Then the implementation class must contain:

public double ejbHomeAverageSalary();

Local interfaces

The EJB 2.0 architecture introduces local interfaces for calls to an EJB component from within the same Java Virtual Machine. In EAServer, you can use local interfaces for intercomponent calls, and for component invocations made from servlets and JSPs hosted by the same server as the component. To use local interfaces, you must configure a local EJB reference for the JSP or EJB component that issues the call.

Using local interfaces can improve performance for calls to components hosted in the same server, but in coding you must be aware of the restrictions listed in “Calling local interface methods”.

CMP enhancements

EJB 2.0 enhances the Container Managed Persistence (CMP) model for entity beans as follows:

For more information on EAServer CMP support, see Chapter 27, “Creating Entity Components.”

EJB 2.0 interoperability

EAServer 4.0 complies with the interoperability requirements in the EJB 2.0 specification to allow interoperability with other EJB 2.0 servers. EAServer continues to support CORBA-2.2 based interoperability, for interacting with other CORBA-based application servers and to allow interoperability between EJB components hosted by EAServer and EAServer components of other types. For more information, see Chapter 9, “EAServer EJB Interoperability.”

Copyright © 2005. Sybase Inc. All rights reserved. EJB 1.1 differences from EJB 1.0