Installation guide
EJB 2.0 support
72 EAServer
For information on JMS and MDB components, see Chapter 31, “Using the
Message Service,” in the EAServer Programmer’s Guide.
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. For information on
defining home interface methods, see Chapter 7, “Creating Enterprise
JavaBeans Components,” in the EAServer Programmer’s Guide.
Create method syntax
In earlier versions, 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 hosted in the same server as the component.
Using local interfaces can improve performance, but in coding you must be
aware that:
• Parameters are passed by reference rather than by copy, so object instances
passed through a local invocation can be shared by the client and
component. If the component modifies the object, the client sees the
changes.
• Local interfaces are not location-transparent. The called component must
be hosted in the same server process as the calling component.