Home > Store

Enterprise JavaBeans: Developing Component-Based Distributed Applications

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

Enterprise JavaBeans: Developing Component-Based Distributed Applications

Book

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

Description

  • Copyright 1999
  • Edition: 1st
  • Book
  • ISBN-10: 0-201-60446-9
  • ISBN-13: 978-0-201-60446-7

Enterprise JavaBeanso facilitates the development of distributed Javao applications, providing an object-oriented transactional environment for building distributed, component-based, multitier enterprise applications.

Enterprise JavaBeans is designed to get you up-to-speed quickly, focusing on the exact information you need to become an effective Enterprise JavaBeans programmer. This example-filled book serves as an introduction and tutorial, and provides the in-depth information you need to handle real-world programming challenges.

This book presents an overview of the architecture, using a "Hello, world!" Enterprise JavaBeans system to illustrate basic concepts. The book then moves on to cover Session and Entity beans, how to write client programs that use Enterprise JavaBeans, and the packaging and deploying of Enterprise JavaBeans. You will find precise explanations on specific topics such as:

  • The differences between stateful and stateless beans
  • The differences between bean-managed and container-managed Entity beans
  • How to call a bean from a servlet, another bean, or an applet
  • How to obtain and examine Enterprise JavaBeans metadata
  • How to identify deployment descriptors and the values they contain
  • How to use access control lists to set up permissions on an Enterprise JavaBeans server
  • How a bean can retrieve and test a client's identity

In addition, substantial examples and an "implementation diary" demonstrate the implementation process, the available options and tradeoffs, and the rationale behind development choices. A chapter devoted to tips and common pitfalls provides concrete rules of thumb for more effective Enterprise JavaBeans programming. The accompanying CD-ROM includes Enterprise JavaBeans software and examples from the book.

Enterprise JavaBeans gives you the background you need to use the system productively in your daily work and puts you on the fast track to mastering Enterprise JavaBeans techniques.



0201604469B04062001

Downloads

Downloads

Click below to download the current version of Weblogic related to this title:
Weblogic Information

Source Code

Click below for Source Code related to this title:
valeskyb.zip

Extras

Web Resources

Click below to download the current version of Weblogic related to this title:
Weblogic Information

Sample Content

Table of Contents



Foreword.


Preface.


1. The Big Picture.

Introduction.

Transaction Processors.

ACID Properties of Transactions.

OLTP Versus OLAP.

Two-Tier, Client-Server Architecture.

Three-Tier Architecture.

Sockets.

RPCs.

CORBA.

RMI.

OLE/DCOM.

Message Queues.

Distributed Transaction Processing.

EJB's Role.

Conclusion.



2. EJB's Architecture.

Logical Architecture.

Overview of EJB's Software Architecture.

EJB Servers.

EJB Containers.

Enterprise Beans.

A High-Level View of an EJB Conversation.

Finding the Bean.

Getting Access to a Bean.

Calling the Bean's Methods.

Getting Rid of the Bean.

RMI Clients.

CORBA Clients.

Building and Deploying EJBs.

Writing the EJB.

Deploying the EJB.

Connecting to the EJB.

Roles in EJB.

Enterprise Bean Provider.

Deployer.

Application Assembler.

EJB Server Provider.

EJB Container Provider.

System Administrator.



3. Hello, EJB!

Requirements.

Design.

Implementation.

Step 1: Create the Remote Interface for the Bean.

Step 2: Create the Bean's Home Interface.

Step 3: Create the Bean's Implementation Class.

Step 4: Compile the Remote Interface, Home Interface, and Implementation Class.

Step 5: Create a Session Descriptor.

Step 6: Create a Manifest.

Step 7: Create an ejb-jar File.

Step 8: Deploy the ejb-jar File.

Step 9: Write a Client.

Step 10: Run the Client.

What's Really Going on Here?

Conclusion.



4. Writing EJB Session Beans.

When to Use Session Beans.

Constraints on Session Beans.

Session Bean Life Cycle.

Transactions and EJB.

Stateful Session Bean Example.

Requirements.

Design.

Implementation.

Summing Up the Stateful Session Bean Example.

Stateless Session Bean Example.

Requirements.

Design.

Implementation.

Deploying the Example.

Conclusion.



5. Writing EJB Entity Beans.

When to Use Entity Beans.

Concurrent Use by Several Clients.

Long Lifetime.

Survival of Server Crashes.

Direct Representation of Data in an Underlying Database.

Bean-Managed Versus Container-Managed Persistence.

Primary Keys.

Entity Bean Life Cycle.

Nonexistence.

The Pooled State.

The Ready State.

Reentrant Instances.

Example: Container-Managed Persistence.

Requirements.

Design.

Implementation.

Example: Bean-Managed Persistence.

Requirements.

Design.

Implementation.

Conclusion.



6. EJB Clients.

An EJB Bean as a Client to Another Bean.

The Home Interface.

The Remote Interface.

The EJB Client Bean.

The Client.

Serializing a Handle.

The Client.

Invoking the Client.

Transactions in Clients.

Authentication in Clients.

Getting Metadata.

A Servlet Client.

HTML to Make a Call to the Servlet.

Setting Up WebLogic Servlets.

An Applet Client.

The Applet Tag.

CORBA Client Example.

What to Look for in a CORBA-Compliant EJB.

Implementation.

HTTP Tunneling and SSL.

Conclusion.



7. Deployment.

The DeploymentDescriptor Class.

The AccessControlEntry Class.

Back to the DeploymentDescriptor Class (I).

The ControlDescriptor Class.

"Run-as" Modes.

Back to the DeploymentDescriptor Class (II).

The SessionDescriptor Class.

The EntityDescriptor Class.

Example Program.

The Home Interface.

The Remote Interface.

The Bean Implementation Class.

The Client.

Using Roles at Runtime.

The ReadDD Class.

The Deployment Descriptor.

Setting Up Access Control Lists.

Container-Managed Finder Methods.

Other Deployment Issues.

Caching Issues.

Persistent Storage.

Properties.

Other Administrative Issues.

Conclusion.



8. Tips, Tricks, and Traps for Building Distributed and Other Systems.

Expect Your Network Connections to Fail.

Test Catastrophic Failure.

Avoid Remote Method Invocations Where Possible.

Treat Transactions and Database Connections as Precious Resources.

Monitor the Granularity of Objects.

Monitor the Granularity of Methods.

Isolate Vendor-Specific Code.

Avoid Making Entity Beans Reentrant.

Observe Programming Restrictions on EJB Beans.

Don't Implement the Bean's Remote Interface in Its Implementation Class.

Use Relatively Small and Well-Defined Queries.

Don't Keep Database Cursors Open.

Minimize Transactions.

Minimize Distributed Transactions.

Avoid Indexing Your Tables.

Remember That Memory Is Cheap.

Build in Upward-Scalability.

Wrap Entity Beans with Session Beans.

Streamline Your Middleware Methods.

Put Your Business Logic in the Middle Tier.

Understand the Tradeoffs Between Isolation Level and Concurrency.

Avoid Extensive Object Allocation and Deallocation.

Prototype, Prototype, Prototype.

Do Load Testing.

Monitor the Size of Your User Base When Designing an Architecture.

Separate Transaction-Processing Tables from Reporting Tables.

If a Database Query Runs Slowly, Review Its Query Plan.

Keep Joins Simple.

Have a Database Administrator.

Use Prepared Statements.

Have Your Development Environment Mirror Your Production Environment.

During Load Testing, Use a Sniffer to Monitor Network Traffic.

Use the Facade Pattern for Interfacing with Legacy Systems.

Use Patterns.

Keep Network Topology in Mind.

Design Security in from the Start.

Work Closely with Network Personnel.

Be Aware of Internal Politics.

Be Aware of the Organizational Culture.

Be Prepared for Requirements Changes.

Build One Slice at a Time.

Build the Difficult Components First.

Talk to Your Users.

Keep It Simple.

Conduct Walkthroughs.

Use Version Control.

Use a Code Profiler.

Establish Your Interfaces Early.

Build Early and Often.

Perform Regression Testing.

Choose Appropriate Test Cases.

Generate Test Cases While Implementing the Application.

Automate Everything.

Understand the Role of Testing.



9. A Nontrival Example.

Requirements.

Design.

Relationships in EJB.

Relationships in General.

Detailed Design.

Database Design.

Detailed Design of the TimeTracker Class.

Detailed Design of the Employee Class.

Designing the TimeSheetHash Class.

Designing the Client.

Implementation.

Building the Database.

Setting Up the Access Control Lists.

Implementing the Employee Bean.

The Final Product.

Employee Home Interface.

Employee Remote Interface.

Employee Implementation.

Employee Primary Key Class.

EmployeeInfo Class.

MyIdentity Class.

TimeSheetLine Class.

TimeSheetHash Class.

The Deployment Descriptor.

Implementing the TimeTracker Bean.

The Home Interface.

The Remote Interface.

Exceptions.

Notes About the Implementation Class.

The Deployment Descriptor.

Implementing the Real Client.

The Client Implementation Class.

An Applet to Run the Client.

Deployment Issues.

Conclusion.



10. Implementations and Future Directions.

EJB Implementations.

WebLogic.

EJBHome.

Other EJB Vendors.

Future Directions for EJB.

Sun's EJB Roadmap.

A Bit of Stargazing.

Conclusion.



Appendix A Source Code for Chapter 4.

Home Interface for Bag Example.

Remote Interface for the Bag Example.

InventoryItem Class.

ItemNotFoundException Exception.

BagBean Implementation Class.

BagBean Client.

Bag2 Home Interface.

Bag2 Remote Interface.

Bag2 Bean Implementation.

Bag2 Client.



Appendix B Source Code for Chapter 5.

Implementation of OrderBean (Container-Managed Persistence).

Client for Container-Managed Entity Bean.

Implementation Bean for Bean-Managed Persistence.

Client for the Bean-Managed Persistence Example.



Appendix C Source Code for Chapter 9.

Implementation of the Employee Entity Bean.

Deployment Descriptor for the Employee Entity Bean.

Implementation Class for the TimeTracker Session Bean.

Deployment Descriptor for the TimeTracker Session Bean.

TimeTracker Client Implementation.



Glossary.


Index.


CD-ROM Warranty. 0201604469T04062001

Preface

This book discusses Enterprise JavaBeans (EJB). It assumes that you have basic knowledge of Java, but does not assume detailed knowledge of distributed computing. The primary goal of this book is to provide a relatively short and easy-to-read document that will get you up to speed quickly on how to develop EJB. Its secondary goal is to serve as a good companion text for a short course on EJB development.

Chapter 1 provides an overview of EJB--that is, what it is and where it fits into the world of distributed computing. If you're looking for technical details, you won't find them in this chapter. Nevertheless, this discussion provides some background that you can use to convince your manager that EJB is a good thing.

Chapter 2 offers an overview of the EJB architecture. It describes the various components that make up an EJB system and covers the major classes and interfaces used in the development of an EJB bean.

Chapter 3 is the first chapter that contains coding examples. It presents a "hello, world!" EJB system. The "hello world" example was chosen for two reasons. First, in coming to terms with a new technology, a simple example is useful in helping you to figure out the core components of the system. Second, the main intent in this chapter is to highlight the steps you need to perform to write and deploy an EJB bean; in this case, a simpler bean provides fewer distractions from this discussion.

Two types of EJB beans exist: Session beans and Entity beans. Chapter 4 covers Session beans. It discusses the differences between stateful and stateless beans, and provides examples of each.

Chapter 5 discusses Entity beans. It describes the differences between bean-managed and container-managed entity beans, providing an example of each.

In Chapter 6, the issue is writing client programs that use EJB beans. It includes quite a few examples, including those demonstrating

  • How to obtain and use handles to beans
  • How to call a bean from a servlet
  • How to call a bean from another bean
  • How to call a bean from an applet
  • How to use client-side transaction management
  • How to obtain and examine EJB metadata

Chapter 7 focuses on the process of packaging and deploying EJB beans. It includes a detailed discussion of deployment descriptors and the values they contain. It also examines access control lists and shows how to use them to set up permissions on an EJB server. In addition, Chapter 7 includes an example that shows how a bean can retrieve and test a client's identity.

Chapter 8 contains a set of tips for constructing distributed systems--or any other type of system, for that matter. The goal of this chapter is to provide you with some concrete rules of thumb that you can use in your own development process and to help you avoid making a few common mistakes.

Chapter 9 includes a relatively nontrivial example program (a time management system) and a sort of "implementation diary" in which the author describes the process used to create the example. This process involves assessing the options available, analyzing the tradeoffs among them, and making the final choices.

In Chapter 10--the "wrap-up" chapter--currently available EJB servers are discussed. Currently, relatively few implementations are available, so we also discuss EJB servers that are not available as of this writing, but should be out soon. This chapter concludes with a discussion of the future of the EJB specification; fortune-telling is a risky business, so the predictions generally stick to issues that are certain to be included in future versions of the EJB standard.

As noted earlier, the goal of this book is to provide you with a quick but thorough introduction to EJB--quick, so you can start using EJB soon, and thorough, so that you won't be flummoxed by real-world situations because only a few canned examples were involved. If you have any comments or suggestions for improvement, please send me an e-mail at tvalesky@patriot.net.

It is a fact of life that the EJB specification and its associated documents will undergo some evolution over the next few years. To accommodate these changes, we've made an online supplement to this book available. This supplement will track changes and new developments in the specification, include new examples that demonstrate new capabilities for EJB, and generally keep you up-to-date with what's going on in the EJB world. Be sure to stop by.

A note on Java versions is in order here. The examples in this book were developed in JDK 1.1, and the accompanying WebLogic software should be run under JDK 1.1 Throughout this book, notations have been made where things will change under Java 2 (formerly known as JDK 1.2). For late-breaking news, refer to his book's companion Web site.

A note about the formatting of the code examples: In the source code in this book, all actual new lines begin with a line number. In some cases, the lines were too long to be displayed correctly and have wrapped around to a new line. So, if you see a line in one of the examples like line 15 here:

15  System.out.println("this is a very very very     long line"); 16  System.out.println("this is shorter");
rest assured that all is well with the actual code.

Acknowledgments

Thanks to the WebLogic folks, especially Bob Pasker and Sriram Srinivasan. Their support has been first-rate.

Thanks to Jonathan K. Weedon of Inprise Corporation for the CORBA client example.

Thanks to the folks on the EJB-INTEREST list, for many happy hours of conversation about EJB, and for serving as a sounding board for many of my ideas.

Thanks to the team at EJBHOME for developing a freeware EJB implementation. The word will spread faster if the price of entry is not into five figures.

Thanks to the reviewers of this manuscript, James D. Frentiss, Liane Acker, Gary McGraw, Ajit Sagar, J. Patrick Ravenal, Ethan Henry, and Jim Inscore, all of whom helped clarify and refine the manuscript.

Thanks to my teachers.

Thanks to Russ Marshall and the gang at BLS, for giving me my first programming job at a time when I had few qualifications other than enthusiasm, and for showing me the value of good requirements and thorough testing.

Thanks to the folks at Javasoft, for changing the world.

Thanks to David Kodama and Dana Gardner, my long-suffering editors at Advisor Publications, for keeping me honest.

Thanks to the staff at Addison Wesley Longman, especially Elizabeth Spainhour, Mary O'Brien, and Maureen Willard.

Thanks to Mom and Dad for putting me through college. Top o' the world, Ma!

--Tom Valesky

0201604469P04062001

Updates

Errata

Click below for Errata related to this title:
Errata

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