Introducing WebLogic Server Enterprise JavaBeans
WebLogic Server 6.1 includes an implementation of Sun Microsystems Enterprise JavaBeans (EJB) architecture as defined by Sun's EJB specification.
Note: WebLogic Server 6.1 is compliant with the Sun J2EE specification and EJB 1.1 specification. It also includes an implementation of the preliminary EJB 2.0 specification. Except where descriptions of EJB features and behaviors make specific mention of EJB 1.1 or EJB 2.0, all information in this guide relates to both implementation. You can deploy existing EJB 1.1 beans in this version of WebLogic Server. However, if you are developing new beans, we recommend that you develop EJB 2.0 beans.
The following sections provide an overview of the EJB features and introduce the changes in the WebLogic Server 6.1 Enterprise JavaBeans implementation:
Overview of Enterprise JavaBeans
Enterprise JavaBeans are reusable Java components that implement business logic and enable you to develop component-based distributed business applications. EJBs reside in an EJB container, which provides a standard set of services such as persistence, security, transactions, and concurrency. Enterprise JavaBeans are the standard for defining server-side components. WebLogic Server's implementation of the Enterprise JavaBeans component architecture is based on Sun Microsystems EJB specification.
An EJB consists of three main components:
To create an EJB, you code a distributed application's business logic into the EJB's implementation class; specify the deployment parameters in deployment descriptor files; and package the EJB into a JAR file. You can then deploy the EJB individually from a JAR file, or package it along with other EJBs and a Web application into an EAR file, which you then deploy on WebLogic Server. Client applications can locate the EJB and create an instance of the bean using the bean's home interface. The client can then invoke the methods of the EJB using the EJB's remote interface. WebLogic Server manages the EJB container and provides access to system-level services such as database management, security management, and transaction services.
Types of EJBs
The EJB specification defines the following four types of Enterprise JavaBeans:
Note: Message driven beans are part of the Sun Microsystems EJB 2.0 specification. They are not part of the EJB 1.1 specification.
Implementation of Preliminary Specifications
The following sections describe the use of WebLogic Server with non-final implementations of Java specifications.
Preliminary J2EE Specification
WebLogic Server 6.1 is available in two different versions that do one of the following:
These two options comply with the rules governing J2EE. Both versions offer the same container and differ only in the APIs that are available.
Preliminary EJB 2.0 Specification
The Enterprise JavaBeans 2.0 implementation in WebLogic Server is fully supported and can be used in production. However, be advised that the Sun Microsystems EJB 2.0 specification is not yet finalized, and the WebLogic Server implementation of the EJB 2.0 architecture is based on the most current public draft of this specification. Consequently once the specification is finalized, there could be changes to the Enterprise JavaBeans 2.0 implementation in future versions of WebLogic Server. These changes may cause application code developed for WebLogic Server 6.1 to be incompatible with EJB 2.0 implementations supported in future releases.
WebLogic Server EJB 2.0 Support
WebLogic Server supports an implementation of Sun Microsystems's EJB 2.0 specification and is compliant with the Sun Microsystem's EJB 1.1 specification. In most cases, you can use EJB 1.1 beans with this version of WebLogic Server. However, in a few cases you may need to migrate existing EJB deployments from earlier versions of WebLogic Server to this version of the EJB container. If necessary, see the information on DDConverter for instructions on converting the beans.
Sun Microsystem's EJB 2.0 specification supports the following new features:
The process of developing EJBs is divided into the following distinct roles.
For more information on the design process, see Designing EJBs.
For more information in the design process, see Designing EJBs. For more information in the assembly process, see Packaging EJBs for the WebLogic Server Container. For more information on the deployment descriptors, see weblogic-ejb-jar.xml Document Type Definitions, and weblogic-cmp-rdbms- jar.xml Document Type Definitions.
For more information on the container management process, see The WebLogic Server EJB Container and Supported Services.
For more information on container-managed persistence, see WebLogic Server Container-Managed Persistence Services. For more information on the deploy process, see Packaging EJBs for the WebLogic Server Container.
Deployment and Management Roles
For more information on the deploy process, see Deploying EJBs to WebLogic Server.
For more information on system administrator's tasks, see the Administration Guide.
EJB Enhancements in WebLogic Server 6.1
The following EJB enhancements are new to this release of WebLogic Server.
Changed EJB Deployment Elements
For information about new and changed deployment elements in WebLogic Server 6.1, see Changed EJB Deployment Elements in WebLogic Server 6.1;
Read-Only Multicast Invalidation Support
Non-transactional entity bean caching provides a better way to invalidate or update cached data. You invalidate a read-only entity bean by using an invalidate method on your home interface. For more information on non-transactional entity bean caching, see Read-Only Multicast Invalidation.
Automatic Generated Primary Key Support
The WebLogic Server EJB container can provide automatically generated primary keys. This feature uses the native automatic key generation facilities provided by Oracle or SQLServer databases. If you are not using one of those databases, you can enable key generation through a user-designated key table. For more information on automatically generated primary keys, see Automatic Primary Key Generation for EJB 2.0 CMP.
Automatic Table Creation
You can automatically create tables based on the deployment descriptions in the deployment files and the bean class, if the table does not already exist. This feature is for use during the development phase and does not provide production quality support. However, it is very helpful for testing your designs prior to deployment in a production environment. For more information on automatic table creation, see Automatic Table Creation.
Oracle SELECT HINTS
You can pass your INDEX usage hints to the Oracle Query optimizer in WebLogic QL queries, which provide hints to the Oracle database engine. This feature is most helpful if you know that the database you are searching would benefit from these hints. For more information on Oracle SELECT HINTS, see Using Oracle SELECT HINTS.
EJB Deployment Descriptor Editor
The EJB Deployment Descriptor Editor is a an extension of the WebLogic Server Administration Console that enables you to edit the deployment descriptors for your EJBs in a graphical environment. For more information on this editor, see Specifying and Editing the EJB Deployment Descriptors and the Administration Console online help.
Use the ejb-client.jar file to package required classes to compile the client into one JAR file. The ejb-client.jar file contains the EJB interfaces necessary to call an EJB. You specify that the WebLogic EJB compiler (weblogic.ejbc) automatically create the ejb-client.jar file in the bean's deployment descriptor file. For more information on ejb-client .jar files, see Specifying an ejb-client.jar.
BLOB and CLOB Support
Use BLOBs and CLOBs to translate large objects into byte arrays or strings, with Oracle. For more information on BLOBs and CLOBs, see BLOB and CLOB DBMS Column Support for the Oracle DBMS.
Cascade Delete Support
The Cascade Delete feature enables you to remove entity objects. You can specify Cascade Delete for one-to-one and one-to-many relationships; many-to-many relationships are not supported. For more information on Cascade Delete, see Cascade Delete.
Local Interface Support
WebLogic Server's EJB container provides support for local interfaces. The EJB container makes the local home interface accessible to local clients through JNDI. Support for remote interfaces with container-managed persistence (CMP) relationships is still available in this release, but not recommended for new development. For more information on local interface support, see Using the Local Client.
Flushing the CMP Cache Support
You can specify that the container-managed persistence (CMP) cache be flushed before every query so that the changes show up in the results. For more information on this feature, see Flushing the CMP Cache.
Tuned CMP 1.1 Support
This release enables the EJB container to support tuned updates for container-managed persistence (CMP) 1.1 entity beans. The EJB container automatically determines and writes back to the database only those container-managed fields that have been modified in the transaction. If no fields are modified, there is no database update.This feature is enabled by default and can be disabled; however, its use is recommended for performance reasons. For more information on tuned CMP support, see Tuned EJB 1.1 CMP Updates in WebLogic Server.
EJB Developer Tools
BEA provides several tools you can use to help you create and configure EJBs.
ANT Tasks to Create Skeleton Deployment Descriptors
You can use the WebLogic ANT utilities to create skeleton deployment descriptors. These utilities are Java classes shipped with your WebLogic Server distribution. The ANT task looks at a directory containing an EJB and creates deployment descriptors based on the files it finds in the ejb.jar file. Because the ANT utility does not have information about all of the desired configurations and mappings for your EJB, the skeleton deployment descriptors the utility creates are incomplete. After the utility creates the skeleton deployment descriptors, you can use a text editor, an XML editor, or the EJB Deployment Descriptor Editor in the Administration Console to edit the deployment descriptors and complete the configuration of your EJB.
For more information on using ANT utilities to create deployment descriptors, see Packaging Enterprise JavaBeans .
EJB Deployment Descriptor Editor
The WebLogic Server Administration Console has an integrated EJB deployment descriptor editor. You must create at least a skeleton of the following deployment descriptor files that you add to the ejb.jar file before using this integrated editor:
For more information, see Web Application Deployment Descriptor Editor Help.
The XML editor is a simple, user-friendly tool from Ensemble for creating and editing XML files. It can validate XML code according to a specified DTD or XML Schema. You can use the XML editor on Windows or Solaris machines and download it from the BEA dev2dev.
Copyright © 2001 BEA Systems, Inc. All rights reserved.