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 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, and both components must be configured to use the same custom class loader. See “Calling local interface methods” for more information.
Defining local interfaces in Java The Java local home interface must extend javax.ejb.EJBLocalHome. Other than the base interface, the requirements are the same as for defining the home interface.
The Java local interface must extend javax.ejb.EJBLocalObject. Other than the base interface, the requirements are the same as for defining the local interface.
Defining local interfaces in IDL In IDL, local home interfaces can contain create and finder methods. The local home for an entity bean can also contain business methods. The IDL syntax is the same as for remote home interfaces, namely:
IDL create methods must return the local interface type and raise CtsComponents::CreateException.
The IDL findByPrimary key method must return the local interface type, accept the primary key type as the sole parameter, and raise CtsComponents::FinderException.
Any additional IDL finder methods must return a sequence of the primary key type and raise CtsComponents::FinderException.
The local interface can be defined in IDL with the same restrictions as for the IDL remote interface.
Copyright © 2005. Sybase Inc. All rights reserved. |