Home > Store

Applying Enterprise JavaBeans: Component-Based Development for the J2EE Platform

Register your product to gain access to bonus material or receive a coupon.

Applying Enterprise JavaBeans: Component-Based Development for the J2EE Platform

Book

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 2001
  • Edition: 1st
  • Book
  • ISBN-10: 0-201-70267-3
  • ISBN-13: 978-0-201-70267-5

Written by the chief architect of the Enterprise JavaBean™ (EJB) specification, Applying Enterprise JavaBeans™ provides complete, in-depth, and authoritative information on the EJB technology. Written for Java developers, IT personnel and independent software vendors (ISVs), this book presents the EJB architecture from the point of view of the person developing EJB applications.

You will find in-depth coverage of such topics as:

  • EJB's place within the Java™ 2 Platform, Enterprise Edition
  • The advantages of the EJB architecture
  • The internal structure of enterprise beans
  • Session beans, including a discussion on stateful versus stateless session beans
  • Entity beans, including life cycle, persistence management, and container management
  • Transaction management
  • Overview of security responsibilities of the various EJB roles
  • Using EJB in application integration

Two example applications that run throughout the book are used to illustrate many of the typical problems encountered in enterprise application development. The first example application, a benefits enrollment application developed by an in-house IT department, explains session beans and how to use them. The second example uses the first example and turns it into an application developed by an ISV, demonstrating how the entity bean architecture helps ISVs overcome the challenges of programming for multiple clients and different operational environments.

In addition to the two application examples, the authors describe the individual features of the EJB architecture and discuss when and how they should be used in applications. The book concludes with a comprehensive API reference.



0201702673B04062001

Sample Content

Downloadable Sample Chapter

Click below for Sample Chapter related to this title:
matena.pdf

Table of Contents

(NOTE: Each chapter ends with a Conclusion.)

Foreword.


Preface.


1. Advantages of the Enterprise JavaBeans Architecture.

From a Two-Tier to J2EE Architecture.

Two-Tier Application Architecture.

Traditional Three-Tier Application Architecture.

Early Web-Based Application Architecture.

J2EE Application Architecture.

Advantages of the Enterprise JavaBeans Architecture.

Benefits to the Application Developer.

Benefits to Customers.



2. Enterprise JavaBeans Architecture Overview.

What Are Enterprise JavaBeans Applications?

Business Entities and Processes and Enterprise Bean Types.

Business Entities.

Business Processes.

Implementation of Business Rules.

Enterprise Bean Types.

Choosing Entity Beans or Session Beans.

When to Use Dependent Objects.

Structure of Enterprise Beans.

Enterprise Bean Home Interface.

Enterprise Bean Remote Interface.

Enterprise Bean Class.

Deployment Descriptor.

Container Tools and Services.

Container Artifacts.

Container Runtime Services.



3. Enterprise JavaBeans Roles.

EJB Roles.

Bean Developer.

Application Assembler.

Deployer.

System Administrator.

EJB Container Provider.

EJB Server Provider.

Tools.



4. Working with Session Beans.

When to Use Session Beans?

Using Session Beans in Web Applications.

Using Session Beans in Traditional Three-Tier Applications.

Understanding the State of a Session Object.

Stateful versus Stateless Session Beans.

Understanding Conversational State.

Overview of the Example Application.

User View of the Application.

Main Parts of the Application.

The “Benefits Enrollment” Business Process.

Enrollment EJB Stateful Session Bean in Detail.

Enrollment EJB Session Bean Parts.

Enrollment Bean Session Bean Class Details.

Client Developer's Perspective.

Payroll EJB Stateless Session Bean.

Payroll EJB Stateless Session Bean Parts.

Client Developer's Perspective.

Database Schemas.

Employee Database Schema.

Benefits Database Schema.

Payroll Database Schema.

Container-Provided Benefits.



5. Session Bean in its Container.

Container Artifacts.

How the Container Manages Session Beans at Runtime.

EJB Home Interface Lookup.

Session Object Creation.

Business Method Invocation.

Session Bean Passivation and Activation.

Session Object Removal.

Session Bean Timeout.



6. Understanding Entity Beans.

Client View of an Entity Bean.

Home Interface.

Remote Interface.

Primary Key and Object Identity.

Entity Object Life Cycle.

Entity Bean Handle.

Bean Developer View of an Entity Bean.

Entity Object Persistence.

Entity Bean Class Methods.

Entity Bean Instance Life Cycle.

Using the ejbLoad and ejbStore Methods.

Designing the Entity Bean Remote Interface.

Concurrent Invocation of an Entity Object.

Using Entity Beans with Pre-Existing Data.



7. Entity Bean Application Example.

Application Overview.

Problem Description.

Main Parts of the Application.

Distributed Deployment.

Pre-existing Parts at Star Enterprise.

EmployeeDatabase.

Payroll System.

Parts Developed by Wombat.

Overview of the Wombat Parts.

EnrollmentEJB Session Bean.

Employee EJB Entity Bean.

Selection EJB Entity Bean.

Wrapper Plan EJB Entity Bean.

Enrollment Web Web Application.

Benefits Admin Web Web Application.

Benefits Database.

Packaging of Parts.

Parts Developed by Premium Health.

Overview.

Premium Health Plan EJB EntityBean.

Helper EJB Session Bean.

Premium Health Admin Web Web Application.

Premium Health AdminApp.

Premium Health Database.

Packaging.

Parts Developed by Providence.

Overview.

Providence Plan EJB EntityBean.

Providence Service Web Web Application.

Packaging.

Summary of the Integration Techniques.

Bean Provider Publishes EJB Client-View Interfaces.

Client Provider Publishes EJB Client-View Interfaces.

Use of Container-managed Persistence.



8. Understanding Transactions.

Declarative Transaction Demarcation.

Transaction Attributes.

Transaction Attribute Values.

Transaction Attributes for Sample Application.

Programmatic Transaction Demarcation.

Transaction Demarcated by a Client.

Transaction Demarcation by a Session Bean.

Pitfalls of Using Programmatic Transaction Demarcation.



9. Managing Security.

Responsibilities of the System Administrator.

Administering Users and Security Principals.

Managing Principal Mapping.

Responsibilities of the Container Provider.

Authentication and Authorization Tasks.

Managing Multiple Applications and Domains.

Application Provider's View of Security.

Client Authentication.

Authorization.

Declarative Security Mechanism.

Security Roles.

Method Permissions.

Programmatic Security API.

Example Application Security.

Deployer's Responsibility.

Deploying Wombat's Enterprise Beans.

Deploying Premium Health's Enterprise Bean.

Deploying Providence's Enterprise Bean.



Appendix A: API Reference.

EJB Object Interface Methods.

EJB Home Interface Methods.

Enterprise Bean Interface.

EJB Context Interface Methods.

EJB Meta Data Interface Methods.

Entity Bean Interface Methods.

Entity Context Interface Methods.

Handle Interface Methods.

Home Handle Interface Methods.

Session Bean Interface Methods.

Session Context Interface Methods.

Session Synchronization Interface Methods.

Exception Classes.

Create Exception Class.

Duplicate Key Exception Class.

EJB Exception Class.

Finder Exception Class.

No Such Entity Exception Class.

Object Not Found Exception Class.

Remove Exception Class.



Appendix B: Code Samples.

CCI Interface Classes.

Data Access Command Beans.



Glossary.


Index. 0201702673T04062001

Preface

This book provides an in-depth coverage of the Enterprise JavaBeans™ architecture. It describes how to distribute enterprise applications using the EJB component architecture.

Readers of this book should be familiar with the Java™ programming language and have had some exposure to enterprise beans and the EJB architecture. Although we briefly cover the basics of the EJB architecture, this book is not meant to be a tutorial for those just getting started with enterprise beans. Instead, the book provides an in-depth coverage of the EJB architecture for IT personnel implementing applications in-house and for Independent Software Vendors (ISVs) developing generic applications for sale to enterprises.

The EJB architecture defines a component model for enterprise applications. It describes:

  • How to design an application as a set of components
  • How the components interact with each other
  • How the components interact with their EJB Container

The EJB architecture defines these interactions as contracts, and they enable applications to use components from different sources. Because EJB components must adhere to these contracts, an application can consist of software components from multiple vendors.

The EJB 1.1 specification defines the architecture contracts mainly from the point of view of the container vendor. In contrast, this book tries to present the EJB architecture from the point of view of the application developer, that is, the person who develops EJB applications.

A detailed description of the development of two enterprise applications forms the backbone of the book. While the example applications are relatively simple, they illustrate many of the typical problems encountered in enterprise application development. We use these examples to show how the EJB architecture helps developers solve these problems.

The first example is a benefits enrollment application developed in-house by an IT department. This application works well for explaining how a session bean works and for illustrating how developers use session beans.

The second example takes the benefits application from the first example, which was developed in-house, and turns it into an application developed by an ISV. An ISV has different design goals from that of an in-house IT department. The ISV must design the application such that it can be easily deployed in many different customers' operational environments. Because each customer has a unique operational environment, the ISV must address a number of challenges. In addition, an ISV typically needs to design the application such that the application can be extended by a customer or integrator. We illustrate how the entity bean architecture helps ISVs to overcome these challenges.

These two annotated examples illustrate many of the techniques for applying the EJB architecture to specific problems in enterprise application development. In addition to the two application examples, we describe the individual features of the EJB architecture and discuss when and how they should be used in applications.

Although the typical application developer does not need to know how the EJB Container works, we try to illustrate some of the inner workings of the EJB Container. We do this mainly to give the reader an appreciation of how much work the Container performs on behalf of the application.

Other Sources of Information

You should refer to other publications related to J2EE. The following books are of particular interest to those developing other application components besides enterprise beans:
  • Java™ 2 Platform, Enterprise Edition Specification, Version 1.2, Copyright 1999, Sun Microsystems, Inc. Available at http://java.sun.com/j2ee/docs.html.
  • Java™ 2 Platform, Enterprise Edition Connector Specification, Copyright 2000, Sun Microsystems, Inc.
  • Java™ 2 Platform, Enterprise Edition, Platform and Component Specification, Shannon, Hapner, Matena, Davidson, Pelegri-Llopart, Cable, Enterprise Team, Copyright 2000, Sun Microsystems, Inc.
  • Enterprise JavaBeans™ 1.1 Specification, Final Release, Copyright 1999, 2000, Sun Microsystems, Inc.
  • Enterprise JavaBeans™ 2.0 Specification, Public Draft, Copyright 2000, Sun Microsystems, Inc.
  • Developing Enterprise Applications with the Java™ 2 Platform, Enterprise Edition, Version 1.0., Kassem, Enterprise Team, Copyright 2000, Sun Microsystems, Inc.
  • RMI over IIOP 1.0.1 Specification, at http://java.sun.com/products/rmi-iiop.

Note About the Example Applications

It is important to note that the example application in Chapter 4, Working with Session Beans, and the entity bean application in Chapter 7, Entity Bean Application Example, are written without the use of an Interactive Development Environment (IDE). Normally, enterprise developers use a commercial IDE when developing EJB applications. An IDE generates much of the JDBC and other database access code—code that is often tedious to write by hand. However, we wanted our examples to illustrate how the EJB architecture works, and had we used an IDE, the code generated by the IDE would obscure the discussion of the EJB architecture. Therefore, we chose to manually write all the code. Keep this in mind and realize that developing with the EJB architecture is easier than some of our code samples might indicate since in practice a lot of the code would be generated automatically by the IDE.

Because our goal is to illustrate using the EJB architecture, we wanted to keep the code relatively simple. As a result, we don't always show what some developers would consider to be the best coding practices for enterprise applications. By including code to show such practices, we would have obscured the EJB discussion. For the sake of simplicity of the code examples, we sometimes do not handle properly all exceptions thrown by the code.

Contents of the Book

The book begins by describing the advantages of the EJB architecture. Chapter 1, Advantages of the Enterprise JavaBeans Architecture, discusses the different enterprise application architectures and how they have evolved, especially with the growth of the Web. It describes the current state-of-the-art EJB and J2EE architectures, and how they are well-suited to meet today's enterprise computing needs.

Chapter 2, Enterprise JavaBeans Architecture Overview, provides a concise overview of the EJB architecture. For someone not so familiar with the EJB architecture, this chapter is a good starting point because it defines the EJB terminology and the structure of enterprise beans. It defines and describes EJB applications, and such basic concepts as business entities and business processes. It provides an overview of the different enterprise bean types, the parts that comprise an enterprise bean, and how to use enterprise beans to model business logic of enterprise applications.

The development of an EJB application can be thought of in terms of the tasks that need to be performed. To that end, Chapter 3, Enterprise JavaBeans Roles, delineates the roles and tasks involved in the application development process.

Once the stage has been set and the introductory material explained, the book focuses on session beans and entity beans. Two chapters focus on session beans and two chapters focus on entity beans. Chapter 4, Working with Session Beans, focuses on typical programming styles for applications using session beans. This chapter is of interest to Bean Developers implementing session beans and to application programmers developing session bean clients. For Bean Developers, the chapter describes how best to implement the methods of a session bean. For application programmers developing session bean clients, it shows how to properly use the session bean home and remote interfaces. An extensive Benefits Enrollment Application example illustrates the key points about session beans.

Chapter 5, Session Bean in its Container, describes the support and services that an EJB Container provides for a session bean. Containers typically provide services to session beans when they are deployed and customized for a particular operational environment, and at runtime, when a client application invokes the session bean. Although the Container services are hidden from the Bean Developer and the client programmer, these services go a long way to simplifying bean and application development. This chapter describes much of what goes on behind the scenes.

After completing its discussion of session beans, the book shifts its focus to entity beans. Entity beans differ significantly from session beans. Chapter 6, Understanding Entity Beans, combines a presentation of the basic concepts regarding programming with entity beans, from both the client and Bean Developer points of view, along with a discussion of the services that the Container provides to entity beans. This chapter is analogous to Chapter 5 for session beans. The chapter also provides a detailed description of strategies for managing entity object state. Chapter 7, Entity Bean Application Example, takes the Benefits example application used for session beans and shows how to write the same application using entity beans. The example illustrates many of the techniques for working with entity beans. It also illustrates how entity beans can be used by ISVs to make their application reusable across many customers' operational environments.

Virtually all applications using enterprise beans rely on transactions. Chapter 8, Understanding Transactions, describes the EJB architecture approach to transaction demarcation. It covers the essential aspects of transactions necessary for application developers.

Security is another area of critical importance to enterprise applications. The EJB architecture provides declarative support for security management. Chapter 9, Managing Security, describes the EJB security environment, particularly from the point of view of the application developer.

Last, the book includes an appendix containing the API reference, a second appendix that contains code samples of supporting classes, and a glossary of terms. The reference section contains all the interfaces defined by the EJB architecture as well as the methods within each interface.



0201702673P04062001

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020