| By Ajit Sagar | Article Rating: |
|
| May 1, 2002 12:00 AM EDT | Reads: |
12,191 |
Although I've been following EJB 2.0 very closely, it was only recently that I walked into a project that was the perfect venue for its new features, such as the much enhanced container-managed persistence and local interfaces. And Enterprise JavaBeans, written by Richard Monson-Haefel, fit the bill as a reference and learning guide.
This is a "must-have" book if you want an introduction to EJBs, are migrating from EJB 1.1 to 2.0, or want to build a new application using EJBs. The author provides a brief introduction to distributed objects and component models in the first chapter; however, if you're unfamiliar with these concepts or with database design, this is not the right book for you. Enterprise JavaBeans talks in detail about the obvious - Enterprise JavaBeans - and stays focused on the subject.
I was very impressed with the organization of the book, which made it a treat to read. One of its main strengths is that it stays focused on specific topics and cleanly separates the 1.1 and 2.0 versions of the EJB specification. For example, if you're only concerned with designing a new application using EJB 2.0, the information isn't cluttered with recurring references to the EJB 1.1 CMP model, which is discussed in a separate chapter.
Chapter 1 introduces distributed computing. Chapter 2 provides an excellent overview of EJBs, including coverage of the standard classes and interfaces, the types of beans, and the deployment descriptor for deploying beans. The author has picked a generic application to illustrate his examples - a reservation for a cruise. If this chapter had contained an overall diagram illustrating the entire hierarchy, including the objects developed throughout the book, it would have been a perfect chapter on EJB architecture.
Chapter 3 deals with the basic services provided by the J2EE component transaction monitors or EJB containers. It provides a good discussion on such topics as the EJB life cycle, object persistence, and the bean-container contract. Chapter 4 walks you through developing and deploying some basic EJBs and covers application development concepts from object design to basic database table design. Chapter 5 covers the design of a basic client to access the beans developed in Chapter 4. The discussion on local versus remote interfaces is very helpful.
Chapters 5-8 were, for me, the most useful chapters in the book. Monson-Haefel walks you through the nuts and bolts of designing entity beans with the new EJB 2.0 persistence model. Chapters 6-7 develop sample entity beans in light of the new persistence model with very lucid examples. The organization of the text is excellent. Monson-Haefel begins each example with the abstract programming model, followed by the abstract persistence schema, then the design of the bean interfaces and classes, and finally the deployment of the bean. Each discussion is autonomous and very clear.
Chapter 7 offers clear guidance on database relationships as they relate to EJB 2.0 CMP. Chapter 8 is a good reference for using EJB-QL.
Chapter 9 deals with EJB 1.1 CMP. Chapters 10-11 discuss the details of bean-managed persistence and the EJB container. Chapter 11 has ample coverage of primary keys, the entity context, and the life cycle of entity beans.
Chapters 12-13 cover the other two types of EJBs (session and message-driven beans). The sample application is developed further in these chapters by TravelAgent Bean, Reservation Process Bean, and associated workflows. Transaction design for EJBs is covered in Chapter 14.
Chapter 15 provides some excellent design strategies for EJB design, such as using hash codes to generate primary keys and dependent value objects to pass objects to and from entity beans. Chapter 16 is a reference chapter on the deployment descriptor for EJBs. This is followed in Chapter 17 by an overview of how EJBs fit into the big J2EE picture. The appendices provide concise references to the EJB APIs and the state and sequence diagrams for the different types of EJBs.
This is one of the best sources of information on EJBs that I've found. It would have been helpful if there were some diagrams of the overall picture, but all in all, this is a very well-organized book about using Enterprise JavaBeans to develop applications.
SIDE BARS
Enterprise JavaBeans
Author: Richard Monson-Haefel
Publisher: O'Reilly & Associates
Table of Contents
Preface
1. Introduction
Setting the Stage
Enterprise JavaBeans Defined
Distributed Object Architectures
Component Models
Component Transaction Monitors
CTMs and Server-Side Component Models
Titan Cruises: An Imaginary Business
What's Next?
2. Architectural Overview
The Enterprise Bean Component
Using Enterprise Beans
The Bean-Container Contract
Summary
3. Resource Management and the Primary Services
Resource Management
Primary Services
What's Next?
4. Developing Your First Enterprise Beans
Choosing and Setting Up an EJB Server
Developing an Entity Bean
Developing a Session Bean
5. The Client View
Locating Beans with JNDI
The Remote Client API
EJB 2.0: The Local Client API
6. EJB 2.0 CMP: Basic Persistence
Overview
The Customer EJB
Persistence Fields
Dependent Value Classes
Relationship Fields
7. EJB 2.0 CMP: Entity Relationships
The Seven Relationship Types
8. EJB 2.0 CMP: EJB QL
Declaring EJB QL
The Query Methods
EJB QL Examples
Problems with EJB QL
9. EJB 1.1 CMP
A Note for EJB 2.0 Readers
Overview for EJB 1.1 Readers
Container-Managed Persistence
10. Bean-Managed Persistence
The Remote Interface
The Remote Home Interface
The Primary Key
The ShipBean
Obtaining a Resource Connection
Exception Handling
The ejbCreate( ) Method
The ejbLoad( ) and ejbStore( )
Methods
The ejbRemove( ) Method
The ejbFind( ) Methods
The Deployment Descriptor
11. The Entity-Container Contract
The Primary Key
The Callback Methods
EJB 2.0: ejbHome( )
EntityContext
The Life Cycle of an Entity Bean
12. Session Beans
The Stateless Session Bean
The Life Cycle of a Stateless
Session Bean
The Stateful Session Bean
The Life Cycle of a Stateful Session Bean
13. Message-Driven Beans
JMS as a Resource
Message-Driven Beans
14. Transactions
ACID Transactions
Declarative Transaction Management
Isolation and Database Locking
Nontransactional Beans
Explicit Transaction Management
Exceptions and Transactions
Transactional Stateful Session Beans
15. Design Strategies
Hash Codes in Compound Primary Keys
Passing Objects by Value
Improved Performance with Session Beans
Bean Adapters
Implementing a Common Interface
Entity Beans Without Create Methods
EJB 1.1: Object-to-Relational Mapping Tools
Avoid Emulating Entity Beans with Session Beans
Direct Database Access from Session Beans
Avoid Chaining Stateful Session Beans
16. XML Deployment Descriptors
What Is an XML Deployment Descriptor?
The Contents of a Deployment Descriptor
The Document Header
The Descriptor's Body
Describing Enterprise Beans
EJB 2.0: Describing Relationships
Describing Bean Assembly
The ejb-jar File
17. Java 2, Enterprise Edition
Servlets
JavaServer Pages
Web Components and EJB
J2EE Fills in the Gaps
Fitting the Pieces Together
Future Enhancements
A. The Enterprise JavaBeans API
B. State and Sequence Diagrams
C. EJB Vendors
Index
Published May 1, 2002 Reads 12,191
Copyright © 2002 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Ajit Sagar
Ajit Sagar is a principal architect with Infosys Technologies, Ltd., a global consulting and IT services company. Ajit has been working with Java since 1997, and has more than 15 years experience in the IT industry. During this tenure, he's been a programmer, lead architect, director of engineering, and product manager for companies from 15 to 25,000 people in size. Ajit has served as JDJ's J2EE editor, was the founding editor of XML Journal, and has been a frequent speaker at SYS-CON's Web Services Edge series of conferences, JavaOne, and international conference. He has published more than 125 articles.
- Kindle 2 vs Nook
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- Confessions of a Ulitzer Addict
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- It's the Java vs. C++ Shootout Revisited!
- Cloud Computing Can Revitalize Your Career as Software Developer
- IBM Could "Reinvent" Java: Mills
- Oracle & Cloud Computing: Exclusive Q&A with SVP Richard Sarwal
- A Brief History of Cloud Computing
- Kindle 2 vs Nook
- Cloud CEOs, CTOs & SVPs to Speak at 4th International Cloud Computing Expo
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- The Difference Between Web Hosting and Cloud Computing
- Cloud Computing Expo: Exclusive Q&A with Yahoo! SVP Cloud Computing
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Confessions of a Ulitzer Addict
- My Thoughts on Ulitzer
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- The i-Technology Right Stuff
- JavaServer Faces (JSF) vs Struts
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- What's New in Eclipse?
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- i-Technology Predictions for 2007: Where's It All Headed?









































