![]() |
![]() |
e-docs > WebLogic Server > Programming WebLogic Enterprise JavaBeans > Introducing WebLogic Server Enterprise JavaBeans |
Programming WebLogic Enterprise JavaBeans
|
Introducing WebLogic Server Enterprise JavaBeans
WebLogic Server includes an implementation of Sun Microsystems Enterprise JavaBeans (EJB) architecture as defined by Sun's EJB specification.
Note: WebLogic Server is compliant with the Sun J2EE specification and EJB 1.1 and EJB 2.0 specifications. 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's 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.
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 Java Specifications
WebLogic Server is compliant with the following Java Specifications.
WebLogic Server 7.0 is compliant with the J2EE 1.3 specification.
The Enterprise JavaBeans 2.0 implementation in WebLogic Server is fully compliant and can be used in production.
Securing WebLogic Server EJB Resources
The vast majority of business applications apply some means of securing application resources so that only certain users can access such resources under certain conditions. WebLogic Server includes robust functionality to protect your EJB resources in this way.
The Securing WebLogic Resources guide gives background information application on and steps you through securing all WebLogic Server application resources, including EJBs.
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 Definitionsand 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 Service. 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.
EJB Enhancements in WebLogic Server 7.0
The following EJB enhancements are new to this release of WebLogic Server.
Changed Deployment Elements in WebLogic Server 7.0
For information about new, changed, or deprecated deployment elements in weblogic-ejb-jar.xml, see Changed Deployment Elements in WebLogic Server 7.0 EJB.
Dynamic queries allow you to construct and execute queries programmatically in your application code. Therefore, all finder queries no longer need to be static and hardcoded into an EJB's deployment descriptor. This gives you the ability to create and execute new queries without having to update and redeploy an EJB and reduces the size of the EJB's deployment descriptor. See Using Dynamic Queries for more information on dynamic queries.
Message-Driven Bean Migratable Service Support
Message-driven bean migratable service support allows the message-driven bean and the Java Messaging Service (JMS) server to migrate to another server in the same cluster, to expedite message-driven bean recovery. In previous versions of WebLogic Server, there was no recovery mechanism for the JMS server and the message-driven bean when a server failed. See Message-Driven Bean Migratable Service for more information on the message-driven bean migration service.
EJB CMP Multiple Table Mapping Support
Multiple table mapping allows you to map a single EJB to multiple DBMS tables within a single database. You use the WebLogic Server-specific CMP container XML deployment descriptors to map multiple DBMS tables and columns to the EJB and its fields. See Multiple Table Mapping for EJB 2.0 CMP for more information on multiple table mapping.
EJB WebLogic QL Enhancements Support
EJB WebLogic QL enhancements support in this release of WebLogic Server includes a set of enhancements to the WebLogic QL query language. WebLogic QL is a WebLogic-specific extension of the EJB 2.0 Query Language known as EJB QL. This enhancement supports the following features:
See Using EJB QL for EJB 2.0 for more information on these three EJB WebLogic QL enhancements.
See Special Note for Oracle Databases for more information on this EJB WebLogic QL enhancement in TRANSACTION_READ_COMMITTED UPDATES.
Optimistic Concurrency Support
Optimistic concurrency support is a new concurrency strategy offered by WebLogic Server. Provides optimistic support with and without caching. The EJB guarantees that the data is consistent by making sure that it was not modified before committing the transaction. See Optimistic Concurrency Strategy for more information on this feature.
ReadOnly Entity Concurrency Support
ReadOnly entity bean concurrency support allows WebLogic Server to activate separate instance of a read-only bean for each transaction that needs concurrent access to that bean. This will eliminate the need for exclusive locking in the EJB Container and allow concurrent requests that access the same bean to proceed in parallel. See ReadOnly Concurrency Strategy for more information on read-only entity bean caching.
Combined caching support allows you to configure a single cache for use with multiple entity beans. This will help solve usability and performance problems. Previously, you were required to configure a separate cache for each entity bean that was part of an application. See Combined Caching with Entity Beans for more information on combined caching.
Relationship caching support will improve entity bean performance by loading related entity beans into a cache and avoid multiple queries by issuing a join query for the related beans. See Combined Caching with Entity Beans for more information on relationship caching.
EJB links support allows you to link EJB references declared in one application component to an enterprise bean contained in the same J2EE application. See Using EJB Links for more information on EJB links.
Bulk insert support increases the performance of container managed persistence (CMP) bean creation by enabling the EJB container to perform multiple database inserts for CMP beans in one SQL statement. This feature allows the container to avoid multiple database inserts. See Database Insert Support for more information on this feature.
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 .
WebLogic Builder is a development tools that provides a visual environment for you to edit an application's deployment descriptor XML files. You can use WebLogic Builder's interface to view these XML files as you edit them, but you will not need to make textual edits to the XML files. For instructions on how to use the WebLogic Builder tool, see WebLogic Builder.
EJBGen is an Enterprise JavaBeans 2.0 code generator. You can annotate your Bean class file with javadoc tags and then use EJBGen to generate the Remote and Home classes and the deployment descriptor files for an EJB application. For more information on EJBGen and a list of the supported javadoc tags, see EJBGen.
The weblogic.Deployer command-line utility is new in WebLogic Server 7.0 and replaces the deprecated weblogic.deploy utility. The weblogic.Deployer utility allows your to initiate deployment from the command line, a shell script, or any automated environment other than Java.
For instructions on using weblogic.Deployer and a list of the commands, see Deploying Using weblogic.Deployer.
WebLogic 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 Specifying and Editing the EJB Deployment Descriptors.
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 Dev2Dev Online.
![]() |
![]() |
![]() |
![]() |
||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |