bea.com | products | dev2dev | support | askBEA |
|
e-docs > WebLogic Server > Programming WebLogic Enterprise JavaBeans > Overview of WebLogic Server Enterprise JavaBeans (EJBs) |
Programming WebLogic Enterprise JavaBeans |
Overview of WebLogic Server Enterprise JavaBeans (EJBs)
The following sections provide an overview of EJBs, and how they are implemented in WebLogic Server, as well as a discussion of WebLogic Server EJB features and changes introduced in this release.
Enterprise JavaBeans (EJBs) 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.
WebLogic Server is compliant with the Sun J2EE specification and EJB 1.1 and EJB 2.0 specifications. While you can deploy existing EJB 1.1 beans in this version of WebLogic Server, BEA strongly recommends that any new beans you develop be EJB 2.0 beans.
The information in this guide is focused on the EJB 2.0 implementation. Features and behaviors specific to EJB 1.1 are covered in Important Information for EJB 1.1 Users.
An entity or session EJB consists of these main components:
A message-driven EJB consists only have a bean class. It has neither component interfaces nor a primary key class.
The EJB container takes care of "behind-the-scenes" system-level work so that beans do not have to. WebLogic Server manages the EJB container, providing EJBs access to system-level services such as database management, lifecycle management, security, and transaction services.
The WebLogic Server EJB Container and Supported Services, examines the WebLogic Server EJB container in detail.
WebLogic Server Container-Managed Persistence Service - Basic Features, and WebLogic Server Container-Managed Persistence Service - Advanced Features, help you design your application to make the best use of the container-managed persistence service the WebLogic Server EJB container provides.
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. Finally you monitor the health of your running EJBs and tune them as needed. The following are the specific steps:
Note: You have a number of different tools to choose from for generating and editing deployment descriptors. See WebLogic Server EJB Tools.
For more information on the deployment descriptors, see The weblogic-ejb-jar.xml Deployment Descriptor, and The weblogic-cmp-rdbms- jar.xml Deployment Descriptor.
For more information on container-managed persistence, see WebLogic Server Container-Managed Persistence Service - Basic Features, and WebLogic Server Container-Managed Persistence Service - Advanced Features. For more information on the deploy process, see Packaging EJBs for the WebLogic Server Container.
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.
DDInit examines the contents of a staging directory and builds the standard J2EE and WebLogic-specific deployment descriptors based on the EJB classes. See DDInit.
The weblogic.Deployer command-line tool allows you 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.
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.
Implementation of Java Specifications
WebLogic Server is compliant with the following Java Specifications.
WebLogic Server 8.1 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.
EJB Features and Changes in this Release
The following EJB features and changes are introduced in this release of WebLogic Server.
Performance Monitoring Improvements
This release introduces greatly improved monitoring of performance, via new tab pages in the WebLogic Server Administration Console.
Performance monitoring is discussed in detail in EJB Runtime Monitoring.
appc provides a single tool for compiling and validating a J2EE ear file, an ejb-jar file or war file for deployment. Previously, a user wanting to compile all modules within an ear file had to extract the individual components of an ear and manually execute the appropriate compiler (jspc or ejbc) to prepare the module for deployment. appc automates this process and performs additional pre-deployment validation checks not previously performed.
appc is discussed in detail in appc.
WebLogic Server now supports batch updates and deletes, in addition to the existing batch insert (previously known as "bulk insert") support. In addition, the EJB container now prevents exceptions by performing dependency checks between batch operations. See Batch Operations.
As application developers develop their entity beans, the underlying table schema must change. With the automatic database detection feature enabled, WebLogic Server automatically changes the underlying table schema as entity beans change. See Automatic Database Detection for more information on automatic database detection.
Compiler error messages in EJB QL now provide a visual aid to identify which part of the query is in error and allow the reporting of more than one error per compilation. See EJB QL Error-Reporting Enhancements for more information on this feature.
WebLogic Server provides improved performance for EJB bulk updates, optimistic concurrency, field groups, relationship caching, and EJB redeployment.
With the Reloadable J2EE Modules feature, you can also redeploy EJBs independently of other components in an Enterprise Application. For more information, see Developing WebLogic Server Applications.
The Administration Console provides an EJB Module Deployment Assistant to help you deploy EJBs. For more information, see the EJB section of the Administration Console Online Help.
WebLogic Server supports two additional values for the dbms-column-type element in weblogic-cmp-rdbms.xml: LongString and SybaseBinary. See dbms-column-type for details.
sql-select-distinct Deprecated
This version of WebLogic Server deprecates the sql-select-distinct element in weblogic-cmp-rdbms-jar.xml. Use the DISTINCT clause directly in finder queries instead of this XML element. For finder queries that have a DISTINCT clause, the container defers duplicate elimination to the database if FOR UPDATE is not used and filter duplicates if used.
If sql-select-distinct is set to true, but the finder query does not have a DISTINCT clause, it is equivalent to not specifying sql-select-distinct but having a DISTINCT clause in the finder query.
If sql-select-distinct is set to false, but the finder query has a DISTINCT clause, the value of sql-select-distinct is ignored.
For more information on sql-select-distinct, see sql-select-distinct.
For more information on the SELECT DISTINCT clause in EJB QL, see Using SELECT DISTINCT.
The ejbc compiler has been deprecated. Use appc in its place.