About the Reviewer
Meera Subbarao has a Bachelors degree in Electronics and Communication Engineering and seventeen years of software programming experience around the globe, from Bangalore,India to Dubai,United Arab Emirates, to the United States. She has spent the past six years at DataSource, Inc. in Maryland and has been working on J2EE technologies exclusively for the last six years.  She is a Sun Certified Java Programmer as well as a Sun Certified Web Component Developer. Meera is also the Team Leader for the Javalobby/dzone book review team.
Spotlight Features

The Rich Engineering Heritage Behind Dependency Injection

Andrew McVeigh takes us on a tour of the rich heritage behind dependency injection, what it represents, and tells us why its here to stay.

NetBeans 6: Matisse Updates

NetBeans 6 delivers great updates to the Matisse GUI builder. Spend a few minutes with Roman Strobl and get an expert briefing on what's new and what has changed.

Introduction to Groovy Part 3

In this, the third and final installation of Andres' Introduction to Groovy series, you learn about how Groovy handles variable numbers of arguments, named parameters, currying, and more about Groovy operators. Including, some new operators.

Easier Custom Components with Swing Fuse

Swing Fuse (actually just Fuse), is a framework designed to make it easier to create your own custom desktop components. In this article, Daniel Spiewak shows you how to get started and provides sample source code you can download.

Benchmark Analysis: Guice vs Spring

Willam Louth shows how he uses JXInsight Probes to investigate probable performance issues with code bases that he is not familiar with. He also highlights possible pitfalls in creating a benchmark, as well as in the analysis of results.

Enterprise JavaBeans 3.0, Fifth Edition

Author(s) Richard Monson-Haefel, Bill Burke
Publisher O'Reilly
PubDate May 2006
Reviewer Meera Subbarao

One Minute Review

Positives

  • Covers EJB 3.0 and JPA 1.0
  • Excellent examples
  • Useful as a reference guide

Negatives

  • Style is tedious - you definitely need a break between chapters

Sections

Intent & Audience

The book intends to explain and demonstrate the fundamentals and advanced topics of the EJB 3.0 and Java persistence API. Because EJB is an extremely complex enterprise technology, this book is not intended for beginners. The reader should be proficient in the Java language and have practical experience developing enterprise applications. A fair amount of JDBC experience also helps to follow along with the examples.

Relevance of material

This book covers EJB 3.0 and Java Persistence 1.0. It also uses Java language features from the Java SE 5 platform. If you're a J2EE developer, this book can be used as a reference guide to understand this new paradigm. The aim of the book is to help the developer develop scalable, portable enterprise applications. This book however does not include any material on previous versions of the EJB specification.

Chapter highlights

The book is organized in two parts: the technical manuscript, and the JBoss workbook. In the first part the author explains what EJB is, how it works, and when to use it. The second part provides step-by-step instructions for installing, configuring, and running the examples on the JBoss 4.0 application server.

Part I. The EJB 3.0 Standard

1. Introduction: Provides a brief introduction to the technologies addressed by EJB and Java persistence, such as component models, distributed objects, asynchronous messaging, and web services.

2. Architectural Overview:In this chapter the author defines the architecture of the EJB component model and examines the differences between the three types of enterprise beans.

3. Resource Management and Primary Services: Explains how the EJB-complaint server manages an enterprise bean at runtime.

4. Developing Your First Beans: You will be able to develop some simple entity and session beans in this chapter. The authors develop the Cabin entity which is part of the Titan Cruises application. Later you will also create a TravelAgent Session bean which serves as a data access interface for the Cabin entity bean.

5. Persistence: EntityManager: This chapter focuses on the details of the persistence service and how it can be accessed within Java EE and also with regular Java programs that run outside of a Java EE environment. The authors explain very well how entity beans interact with the new entity manager service.

6. Mapping Persistent Objects: The authors explain the basic persistence mappings provided by the Java persistence specification by developing a Customer and Address entities for the Titan Cruises Java EE application, including various ways to define primary keys as well as simple and complex property-type mappings.

7. Entity Relationships: This chapter continues with Titan Cruises application by discussing the seven relationships that entity beans can have with each other and how to specify relationships by applying annotations to related entity beans.

8. Entity Inheritance: Inheritance was completely missing from earlier versions of EJB CMP 2.1 specifications. The new Java Persistence specification supports entity inheritance and this chapter covers the three different ways to map an inheritance hierarchy to a relational database.

9. Queries and EJB QL: EJB QL existed in the earlier version of the EJB specification also and is available in the new release as well. This chapter covers EJB QL, which is used to query entity beans and to locate specific entity beans in Java persistence.

10. Entity Callbacks and Listeners: The authors discuss how you can register your entity bean classes for life cycle callbacks as well as how to write entity listeners that can intercept life cycle events on your entities.

11. Session Beans: This chapter shows how to develop stateless as well as stateful session beans and also the Life cycle for each one of them.

12. Message-Driven Beans: Writing a MDB was simple in the earlier EJB specifications, it's even simpler in this specification version also with the use of annotations. This chapter examines both JMS-based message-driven beans as well as the expanded message-drive bean model available to EJB 3.0 developers.

13. Timer Service: This chapter discusses how to use the EJB Timer Service API and its use with stateless session and message-driven beans. There is also a section on problems with the Timer Service and suggestions to improve the same.

14. The JNDI ENC and Injection: Explains the JNDI ENC as well as the new injection annotation and their XML equivalents. In this chapter, you will learn in detail how you can populate the ENC and use it as your own JNDI registry, and also use it to inject environment references into your bean fields.

15. Interceptors: One of the new features introduced in the EJB 3.0 specification is interceptors and this chapter discusses the EJB interceptors and how to use them to extend the behavior of the EJB container. This chapter also has quite a few real world examples of where interceptors can be used.

16. Transactions: Provides an in-depth explanation of transactions and describes elegantly the transaction model defined by the EJB. The authors explain the four characteristics of a good and safe transaction and show how to apply them to TravelAgent stateful session bean.

17. Security: EJB 3.0 provides annotations to specify security options and this chapter walks you through the basics of EJB security. Security is easy in EJB, because you're only dealing with authorization since the EJB specification does not specify how authentication happens. Most security features in this chapter cover declarative security; however the last section covers programmatic security.

18. EJB 3.0: Web Services Standards: This chapter provides an overview of the technologies that are the foundation of web services:  XML, SOAP, WSDL, and UDDI web services standards. If you are familiar with all these technologies, you can easily skip reading this chapter.

19. EJB 3.0 and Web Services: Discusses how the JAX_RPC API supports web services in EJB. The authors show you how easy it is to transform a stateless EJB by adding two annotations @WebService and @WebMethod into a web service.

20. Java EE: Provides an overview of Java EE 5 and explains how EJB 3.0 fits into this new platform. This chapter provides a brief introduction of Servlets and JSP and how these technologies fit together with the Enterprise JavaBeans.

21. EJB Design in the Real World: This chapter provides some basic design strategies that can simplify your EJB development efforts and make your EJB system more efficient. A well written chapter which covers the most basic questions you need to ask before you even begin designing your EJBs and entity beans. There is also a section on should you use EJBs? At the end of this section, alternative approaches for EJBs and where they might fit.

Part II. The JBoss Workbook

1. JBoss Installation and Configuration: Read this part to download, set up JBoss and configure it to run the examples.

2. Exercises: Depending on which chapter you are reading, you can go to the workbook chapter that matches the chapter you are reading, develop and run the examples on JBoss.

3. Appendix: Describes how to set up database pools for data sources other than Hypersonic SQL and configure your EJBs and entity beans to use these database pools.

Comparison

With EJB 3 gaining momentum, there are a number of books now available in the market. I read two of the books "Beginning EJB™ 3 Application Development: From Novice to Professional" from Apress and "Enterprise Java Beans 3.0, Fifth Edition"from O'Reilly. Here is a straightforward comparison to help you choose the book for your needs.

Category
Beginning EJB™ 3 Application Development Enterprise Java Beans 3.0,Fifth Edition
Readability Easy to read. Reading gets a bit tougher.
Java Expertise Level
Advanced Advanced
J2EE Expertise Level Intermediate - Advanced Beginner-Advanced
Working examples Good but errors in examples. Excellent working examples.
Previous EJB Experience Required Not Required
Application Server used GlassFish Server JBoss
Database Used
Oracle Hypersonic SQL

If you have had previous experience with earlier versions of the EJB specification, or plan to migrate to the new spec, then the book "Beginning EJB™ 3 Application Development: From Novice to Professional" would be an excellent choice. On the other hand, if you would like to see what EJB 3.0 offers, "Enterprise Java Beans 3.0, Fifth Edition" sets the standard.

If technical material is of great importance, both books provide this equally well. However "Enterprise Java Beans 3.0, Fifth Edition " gets a little tedious if you continue reading for a long time when compared to "Beginning EJB™ 3 Application Development: From Novice to Professional". In contrast, if you want good working examples then I would suggest you look at "Enterprise Java Beans 3.0, Fifth Edition".

In conclusion, both books have some strong and weak points, get a book buddy or your colleague and buy both of them. That way, you get the benefits of both books.

Rating

While EJB 3.0 makes application development much simpler, it's still a complex technology which requires a significant amount of time to learn and master it. If you have the time and the interest to learn this technology, this book is for you.

All in all, this is a very helpful and useful publication from O'Reilly. I believe the authors were successful in achieving what they set out to do, provide you with the foundation needed to jump start your EJB 3.0 development. The JBoss workbook should provide you with all the required knowledge to use this technology with greater confidence.

Last but not the least, this book is a good addition to the library of any J2EE developer.

Relevance
Readability
Overall  

Resources