Chapter 8 Creating J2EE Applications for BEA WebLogic
WebLogic Server provides support for local interfaces. The EJB 2.0 specification requires that relationships for EJBs with container-managed-persistence be based on local interfaces. If the EJB is an entity or session bean, it can have either a local or remote interface or both. Previously, calling a relationship on an EJB could be potentially expensive because it could involve a remote call. Currently, WebLogic Server provides support for both local and remote interfaces. However, relationships in CMP that use remote interfaces should probably not be used in new code.
The ejbSelects is used to return remote interfaces. Now you can specify a result-type-mapping element in the ejb-jar.xml file that indicates whether the result returned by the query will be mapped to a local or remote object.
The EJB container makes the local home interface accessible to local clients through JNDI. To reference a local interface you need to have a local JNDI name. The objects that implement the entity beans' local home interface are called EJBLocalHome objects.
Local objects are lightweight persistent objects that are designed to allow you to do more fine grade coding.
Local interfaces use pass-by-reference. The getter is in the local interface.
A local client of a session bean or entity bean may be another EJB, such as a session bean, entity bean, or message-driven bean; it can be a servlet or remote as long as it is part of the same EAR file and as long as it is not remote.
A local client accesses a session or entity bean through the bean's local interface and local home interfaces. The container provides classes that implement the bean's local and local home interfaces. The objects that implement these interfaces are local Java objects.
Clients of a local bean must be part of an EAR, or if not an EAR, at least a standalone .jar.
The following diagram shows a container with a local client and local interfaces:
WebLogic Server provides support for both local and uni-directional remote relationships between EJBs. If the EJBs are on the same server and are part of the same JAR file, they can have local relationships. If the EJBs are not on the same server, the relationships must be remote. For a relationship between local beans, multiple column mappings are specified if the key implementing the relation is a compound key. For a remote bean, only a single column-map is specified, since the primary key of the remote bean is opaque. No column-maps are specified if the role just specifies a group-name and group-name is specified if the relationship is remote.
Changes made to the structure of the container to accommodate local interfaces include the following additions:
Copyright (C) 2005. Sybase Inc. All rights reserved. |
![]() |