Synopses & Reviews
If you're up on the latest Java technologies, then you know that Enterprise JavaBeans (EJB) 3.0 is the hottest news in Java this year. In fact, EJB 3.0 is being hailed as the new standard of server-side business logic programming. And O'Reilly's award-winning book on EJB has been refreshed just in time to capitalize on the technology's latest rise in popularity.
This fifth edition, written by Bill Burke and Richard Monson-Haefel, has been updated to capture the very latest need-to-know Java technologies in the same award-winning fashion that drove the success of the previous four strong-selling editions. Bill Burke, Chief Architect at JBoss, Inc., represents the company on the EJB 3.0 and Java EE 5 specification committees. Richard Monson-Haefel is one of the world's leading experts on Enterprise Java.
Enterprise JavaBeans 3.0, 5th Edition is organized into two parts: the technical manuscript followed by the JBoss workbook. The technical manuscript explains what EJB is, how it works, and when to use it. The JBoss workbook provides step-by-step instructions for installing, configuring, and running the examples from the manuscript on the JBoss 4.0 Application Server.
Although EJB makes application development much simpler, it's still a complex and ambitious technology that requires a great deal of time to study and master. But now, thanks to Enterprise JavaBeans 3.0, 5th Edition, you can overcome the complexities of EJBs and learn from hundreds of practical examples that are large enough to test key concepts but small enough to be taken apart and explained in the detail that you need. Now you can harness the complexity of EJB with just a single resource by your side.
Learn how to code, package, deploy, and test functional Enterprise JavaBeans with the latest edition of this bestselling guide. Written by the developers of the JBoss EJB 3.1 implementation, this book brings you up to speed on each of the component types and container services in this technology, while the workbook in the second section provides several hands-on examples for putting the concepts into practice.
Enterprise JavaBeans 3.0 presented a radical departure from its predecessors with a lightweight alternative that met with enthusiastic response from the Java development community. With version 3.1, EJB's server-side component model for building distributed business applications is simpler yet. And Enterprise JavaBeans 3.1 is the most complete reference you'll find on this specification.
- Learn how to encapsulate business logic with Session Beans and Message-Driven Beans
- Understand EJB's container services, such as dependency injection, concurrency, and interceptors
- Handle persistence through the Entity Bean and EntityManager
- Discover how to integrate with other technologies in the Java Enterprise Edition platform
EJB 3.0 has simplified the programming model for Enterprise JavaBeans (EJBs) dramatically and introduced a new Java Persistance specification. This new edition delivers the latest need-to-know Java technologies.
Learn how to code, package, deploy, and test functional Enterprise JavaBeans with the latest edition of this bestselling guide. Written by the developers of JBoss EJB 3.1, this book not only brings you up to speed on each component type and container service in this implementation, it also provides a workbook with several hands-on examples to help you gain immediate experience with these components.
With version 3.1, EJB's server-side component model for building distributed business applications is simpler than ever. But it's still a complex technology that requires study and lots of practice to master. Enterprise JavaBeans 3.1 is the most complete reference on this specification. You'll find a straightforward, no-nonsense explanation of the underlying technology, including Java classes and interfaces, the component model, and the runtime behavior of EJB.
- Develop your first EJBs with a hands-on walkthrough of EJB 3.1 concepts
- Learn how to encapsulate business logic with Session Beans and Message-Driven Beans
- Discover how to handle persistence through Entity Beans, the EntityManager, and the Java Persistence API
- Understand EJB's container services such as dependency injection, concurrency, and interceptors
- Integrate EJB with other technologies in the Java Enterprise Edition platform
- Use examples with either the JBossAS, OpenEJB, or GlassFish v3 EJB Containers
About the Author
Bill Burke was born in 1943 and received both his BFA and MFA in Photography from the Rhode Island School of Design. He has exhibited in solo and group exhibitions around the world, and his works are in the collections of the the International Center of Photography, The Metropolitan Museum of Art, and the Museum of Modern Art, New York; the Los Angeles County Museum of Art, the J. Paul Getty Museum, Los Angeles; the San Francisco Museum of Modern Art; the Smithsonian Institution of American Art, Washington, D.C.; the Museum of Fine Arts, Boston; the Museum of Fine Arts, Houston; and the Center for Creative Photography, Tucson; among others. Burke has received numerous honors, including five National Endowment for the Arts grants, and the John Simon Guggenheim Fellowship. Burke lives in Dorchester, Massachusetts.Richard Monson-Haefel is the author of Enterprise JavaBeans (Editions 1 - 5), Java Message Service and one of the world's leading experts and book authors on enterprise computing. He was the lead architect of OpenEJB, an open source EJB container used in Apache Geronimo, a member of the JCP Executive Committee, member of JCP EJB expert groups, and an industry analyst for Burton Group researching enterprise computing, open source, and Rich Internet Application (RIA) development. Today, Richard is the VP of Developer Relations for Curl, Inc. a RIA platform used in enterprise computing. You can learn more about Richard at his web site Monson-Haefel.
Table of Contents
Dedication; Foreword; Preface; Author's Note; Who Should Read This Book; How This Book Is Organized; Software and Versions; Conventions Used in This Book; Using Code Examples; Safari® Enabled; Comments and Questions; Acknowledgments; Part I: The EJB 3.0 Standard; Chapter 1: Introduction; 1.1 Server-Side Components; 1.2 Persistence and Entity Beans; 1.3 Asynchronous Messaging; 1.4 Web Services; 1.5 Titan Cruises: An Imaginary Business; 1.6 What's Next?; Chapter 2: Architectural Overview; 2.1 The Entity Bean; 2.2 The Enterprise Bean Component; 2.3 Using Enterprise and Entity Beans; 2.4 The Bean-Container Contract; 2.5 Summary; Chapter 3: Resource Management and Primary Services; 3.1 Resource Management; 3.2 Primary Services; 3.3 What's Next?; Chapter 4: Developing Your First Beans; 4.1 Developing an Entity Bean; 4.2 Developing a Session Bean; Chapter 5: Persistence: EntityManager; 5.1 Entities Are POJOs; 5.2 Managed Versus Unmanaged Entities; 5.3 Packaging a Persistence Unit; 5.4 Obtaining an EntityManager; 5.5 Interacting with an EntityManager; 5.6 Resource Local Transactions; Chapter 6: Mapping Persistent Objects; 6.1 The Programming Model; 6.2 Basic Relational Mapping; 6.3 Primary Keys; 6.4 Property Mappings; 6.5 Multitable Mappings with @SecondaryTable; 6.6 @Embedded Objects; Chapter 7: Entity Relationships; 7.1 The Seven Relationship Types; 7.2 Mapping Collection-Based Relationships; 7.3 Detached Entities and FetchType; 7.4 Cascading; Chapter 8: Entity Inheritance; 8.1 Single Table per Class Hierarchy; 8.2 Table per Concrete Class; 8.3 Table per Subclass; 8.4 Mixing Strategies; 8.5 Nonentity Base Classes; Chapter 9: Queries and EJB QL; 9.1 Query API; 9.2 EJB QL; 9.3 Native Queries; 9.4 Named Queries; Chapter 10: Entity Callbacks and Listeners; 10.1 Callback Events; 10.2 Callbacks on Entity Classes; 10.3 Entity Listeners; Chapter 11: Session Beans; 11.1 The Stateless Session Bean; 11.2 SessionContext; 11.3 The Life Cycle of a Stateless Session Bean; 11.4 The Stateful Session Bean; 11.5 The Life Cycle of a Stateful Session Bean; 11.6 Stateful Session Beans and Extended Persistence Contexts; 11.7 Nested Stateful Session Beans; Chapter 12: Message-Driven Beans; 12.1 JMS and Message-Driven Beans; 12.2 JMS-Based Message-Driven Beans; 12.3 The Life Cycle of a Message-Driven Bean; 12.4 Connector-Based Message-Driven Beans; 12.5 Message Linking; Chapter 13: Timer Service; 13.1 Titan's Maintenance Timer; 13.2 Timer Service API; 13.3 Transactions; 13.4 Stateless Session Bean Timers; 13.5 Message-Driven Bean Timers; 13.6 Final Words; Chapter 14: The JNDI ENC and Injection; 14.1 The JNDI ENC; 14.2 Reference and Injection Types; Chapter 15: Interceptors; 15.1 Intercepting Methods; 15.2 Interceptors and Injection; 15.3 Intercepting Life Cycle Events; 15.4 Exception Handling; 15.5 Interceptor Life Cycle; 15.6 Bean Class @AroundInvoke Methods; 15.7 Future Interceptor Improvements; Chapter 16: Transactions; 16.1 ACID Transactions; 16.2 Declarative Transaction Management; 16.3 Isolation and Database Locking; 16.4 Nontransactional EJBs; 16.5 Explicit Transaction Management; 16.6 Exceptions and Transactions; 16.7 Transactional Stateful Session Beans; 16.8 Conversational Persistence Contexts; Chapter 17: Security; 17.1 Authentication and Identity; 17.2 Authorization; 17.3 The RunAs Security Identity; 17.4 Programmatic Security; Chapter 18: EJB 3.0: Web Services Standards; 18.1 Web Services Overview; 18.2 XML Schema and XML Namespaces; 18.3 SOAP 1.1; 18.4 WSDL 1.1; 18.5 UDDI 2.0; 18.6 From Standards to Implementation; Chapter 19: EJB 3.0 and Web Services; 19.1 Accessing Web Services with JAX-RPC; 19.2 Defining a Web Service with JAX-RPC; 19.3 Using JAX-WS; 19.4 Other Annotations and APIs; Chapter 20: Java EE; 20.1 Servlets; 20.2 JavaServer Pages; 20.3 Web Components and EJB; 20.4 Filling in the Gaps; 20.5 Fitting the Pieces Together; Chapter 21: EJB Design in the Real World; 21.1 Predesign: Containers and Databases; 21.2 Design; 21.3 Should You Use EJBs?; 21.4 Wrapping Up; Part II: The JBoss Workbook; Chapter 22: Introduction; 22.1 Contents of the JBoss Workbook; Chapter WORKBOOK 1: JBoss Installation and Configuration; 23.1 About JBoss; 23.2 Installing the JBoss Application Server; 23.3 A Quick Look at JBoss Internals; 23.4 Exercise Code Setup and Configuration; Chapter WORKBOOK 2: Exercises for Chapter 4; 24.1 Exercise 4.1: Your First Beans with JBoss; 24.2 Exercise 4.2: JNDI Binding with Annotations; 24.3 Exercise 4.3: JNDI Binnnnnnding with XML; Chapter WORKBOOK 3: Exercises for Chapter 5; 25.1 Exercise 5.1: Interacting with EntityManager; 25.2 Exercise 5.2: Standalone Persistence; Chapter WORKBOOK 4: Exercises for Chapter 6; 26.1 Exercise 6.1: Basic Property Mappings; 26.2 Exercise 6.2: @IdClass; 26.3 Exercise 6.3: @EmbeddedId; 26.4 Exercise 6.4: Multitable Mappings; 26.5 Exercise 6.5: Embeddable Classes; Chapter WORKBOOK 5: Exercises for Chapter 7; 27.1 Exercise 7.1: Cascading; 27.2 Exercise 7.2: Inverse Relationships; 27.3 Exercise 7.3: Lazy Initialization; Chapter WORKBOOK 6: Exercises for Chapter 8; 28.1 Exercise 8.1: Single Table per Hierarchy; 28.2 Exercise 8.2: Single Table per Hierarchy; 28.3 Exercise 8.3: JOINED Inheritance Strategy; Chapter WORKBOOK 7: Exercises for Chapter 9; 29.1 Exercise 9.1: Query and EJB QL Basics; Chapter WORKBOOK 8: Exercises for Chapter 10; 30.1 Exercise 10.1: Entity Callbacks; 30.2 Exercise 10.2: Entity Listeners; Chapter WORKBOOK 9: Exercises for Chapter 11; 31.1 Exercise 11.1: Stateless Session Bean; 31.2 Exercise 11.2: XML Override; 31.3 Exercise 11.3: Annotationless Stateless Session Bean; 31.4 Exercise 11.4: Stateful Session Bean; 31.5 Exercise 11.5: Annotationless Stateful Session Bean; Chapter WORKBOOK 10: Exercises for Chapter 12; 32.1 Exercise 12.1: The Message-Driven Bean; Chapter WORKBOOK 11: Exercises for Chapter 13; 33.1 Exercise 13.1: EJB Timer Service; Chapter WORKBOOK 12: Exercises for Chapter 15; 34.1 Exercise 15.1: EJB Interceptors; 34.2 Exercise 15.2: Intercepting EJB Callbacks; Chapter WORKBOOK 13: Exercises for Chapter 16; 35.1 Exercise 16.1: Conversational Persistence Contexts; Chapter WORKBOOK 14: Exercises for Chapter 17; 36.1 Exercise 17.1: Security; 36.2 Exercise 17.2: Securing Through XML; Chapter WORKBOOK 15: Exercises for Chapter 19; 37.1 Exercise 19.1: Exposing a Stateless Bean; 37.2 Exercise 19.2: Using a .NET Client; Part III: Appendix; JBoss Database Configuration; A.1 Set Up the Database; A.2 Examine the persistence.xml File; A.3 Start Up JBoss; A.4 Build and Deploy the Example Programs; A.5 Examine and Run the Client Applications; Colophon;