When my 9-year-old boy spotted me reading Enterprise JavaBeans, he asked what the book was about. I prepared to launch into an explanation of EJB as a platform-neutral specification for building distributed, component-based enterprise applications in Java. I then decided that would be lost on a kid who thinks of the computer in his room as nothing more than his personal video arcade, so I answered simply, “Computer stuff.”
“Oh,” he replied and then asked a question I didn’t have a good answer for. “Then why is there a kangaroo on the cover?”
References to O’Reilly Publishing’s penchant for decorating technical book covers with drawings of animals aside, earlier editions of Enterprise JavaBeans have been perennial favorites among Java developers. The book has garnered awards from both JavaPRO and Java Developer’s Journal magazines. These awards are well deserved—Enterprise JavaBeans is a thorough, easy-to-read, and well-thought-out book, extremely useful to beginners and grizzled veterans alike. (By the way, that’s a wallaby, not a kangaroo.)
Updated for EJB 2.0
This third edition has been heavily updated to cover the changes made to version 2.0 of Sun’s EJB specification and includes detailed explanations of the workings of, and need for, each major new feature. But the author doesn’t abandon those who have yet to make the leap to the relatively new version; he still covers version 1.1. While smaller differences between the specification’s versions are usually explained parenthetically or via footnotes, entire chapters or sections are devoted to the larger ones. For example, two chapters cover Container-Managed Persistence: one on version 1.1’s implementation and a second on version 2’s.
The author, Richard Monson-Haefel, is a bona fide domain expert, having served as a consultant during the creation of the EJB specification itself. He’s working to design and build OpenEJB, an open source EJB “container server” (which he explains the need for in the book). He also runs jMiddleware, which is dedicated to the discussion of EJB and other similar Java technologies. Monson-Haefel knows his stuff, and it comes through in his book.
The story of Titan Cruises: A complete walk-through
Throughout the book, you’ll be referred to an EJB application built to support a fictional cruise line, Titan Cruises. Since Titan Cruises uses a real business domain, fictional though the company is, having the company as a backdrop provides some useful context for the sample application. The choice of this single nontrivial example instead of numerous disconnected ones is a thoughtful touch (one of many you’ll discover as you read) that makes the material more easily understood.
With the cruise line management system as a backdrop, Monson-Haefel gives more than enough code to satisfy new EJB programmers. With a lengthy design strategies chapter, he also manages to provide enough analysis and distributed architecture details to make his book worthwhile for analysts and managers too.
A complete reference, full of nice touches
After a brief architectural overview and comparison of EJB to other object technologies like DCOM and CORBA in the first chapters of the book, you’ll see your first code and build your first bean. This exercise involves the creation of an entity bean to model a cabin on a cruise ship. Here, you’ll discover the second of many nice touches.
The way each EJB server manages its components is proprietary, making installing and deploying beans to a server a proprietary process. So at this point of a tutorial, you’d expect a cop-out along the lines of “consult your vendor’s documentation for details.” Instead, you’re told you can download one of several free workbooks for specific information on deploying a bean to a particular server.
Next, the book moves on to more advanced topics. Enterprise JavaBeans has detailed sections covering transactions, session and message-driven beans, and both persistence strategies offered by EJB: container-managed and bean-managed. XML-driven deployment is covered also.
Enterprise JavaBeans is the most thorough introduction to the EJB technology available and deserves the awards it has received. If you’re just getting started with EJB or need a reference to the new version of the specification, give this title a long look.