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.
| Author(s): | Raghu R. Kodali and Jonathan Wetherbee with Peter Zadrozny |
|---|---|
| Publisher: | Apress |
| PubDate: | 2006 |
| Reviewer: | Meera Subbarao |
This book is targeted at developers who are experienced with Java and have built multi-tier applications using earlier versions of EJB. In order to work out the examples in this book, you should be very proficient in using the command line and/or Ant. Working knowledge of the GlassFish application server is also needed.
If you have already worked with the previous versions of the EJB specifications and want to migrate to EJB3 - or even just want to find out how it works - this will be the perfect guide for you. The examples throughout the book should give the reader a very good understanding of EJB3. It should be easy to migrate your earlier versions of EJB applications to EJB3 with this book in your library.
The only issue I had with the book was with the build files (Ant scripts) provided. I have been using Ant for several years and didn't feel they were up to the level of the rest of the book. For example, the book suggests you set an environment variable for GLASSFISH_HOME, but this value isn't used in the build files: instead, a property is set in the properties file for chapter 1. If you skip reading the readme file (and who doesn't?), you will spend a lot of time probing what went wrong before you find it.
Once you finish reading this book, you will agree with me that the new EJB 3 specification (JSR-220) offers great improvements over the earlier EJB versions in terms of simplifying development, adding new features, facilitating test-driven development, and focusing more on POJOs rather than on complex APIs.
CHAPTER 1: Introduction to the EJB 3 Architecture starts by introducing the book and offers an insight into EJB, covering the EJB framework and component model, the core features of EJB, the history of EJB, the EJB 3 simplified development model, and the EJB distributed computing model. It concludes with a "Getting Started" section to help you install the GlassFish application server. I should mention that I had huge problems with GlassFish server: Jon along with Raghu helped me fix the problems so that I could continue working through the examples. Thanks, guys.
CHAPTER 2: EJB 3 Session Beans covers the two different session bean types, stateless and stateful, including their differences, some general use cases for each, and the usage of dependency injection in stateless and stateful beans. You also learn how to use callback methods and interceptors, as well as the use of annotations like @PostContruct and @PreDestroy. Once I got the sample working from the book, I did create my own Hello Session bean, deployed and tested the same.
CHAPTER 3: Entities and the Java Persistence API starts by showing how a simple JavaBean (Customer.java) can be transformed into an entity by adding annotations. The next few sections help you explore the persistent archive, the persistence unit, the persistence context and the EntityManager. The section on O/R mapping discusses how entities map to their database tables and how entity relationships work. If you have worked with earlier versions of EJBs, you will definitely appreciate EJB 3: it's so simple to use.
CHAPTER 4: Advanced Persistence Features covers advanced persistence concepts. This chapter describes the new support offered in the JPA for mapping entity inheritance hierarchies. Examples of the three supported inheritance mapping strategies identify the strengths and weaknesses of each approach to help you decide which best suits the particular needs of your application. This chapter also covers the ID (primary key) generators introduced in the JPA, for auto-populating ID values using a database sequence or table.
CHAPTER 5: EJB 3 Message-Driven Beans. MDBs were simpler than other bean types in the earlier EJB versions, requiring only the bean class. They are simpler in EJB3 version too, except that the @MessageDriven annotation has numerous properties. This chapter gives all the details necessary to implement an asynchronous application using MDBs. The examples in this chapter give the user a clear picture of how to use JMS in their enterprise applications.
CHAPTER 6: EJB 3 and Web Services. Stateless session beans provide an excellent implementation for web services, and this chapter explores EJB's support for this fine marriage of technologies. It's so very trivial to publish web services using EJB3: just add 2 annotations and you have it. I should mention that I used a neat tool called SoapUI, a desktop application to invoke web services over HTTP, to interact with the web services I created.
CHAPTER 7: Integrating Session Beans, Entities, Message-Driven Beans, and Web servicesgives the user an in-depth discussion on how to integrate different types of EJBs and web services with resources like data sources, JMS topics and JavaMail using an extensive wine store application.
CHAPTER 8: Transaction Support in EJB 3. Transaction support is a key feature in any enterprise application, especially so in database applications. EJB 3 makes it very easy to declare transaction properties for any method using annotations. This chapter applies two alternative transactional models to a single logical scenario to explore the pros and cons of each approach.
CHAPTER 9: EJB 3 Performance and Testing. If you plan on doing some performance testing on your EJB3 application you have developed until now, this chapter explains how to set up performance tests. The authors do mention that they were highly impressed by the results.
CHAPTER 10: Migrating EJB 2.x Applications to EJB 3discusses possible migration strategies for moving applications written using EJB 2.1 or an earlier specification to EJB 3. Migrating applications to EJB 3.0 should be a fairly trivial task once you finish reading this chapter.
CHAPTER 11: EJB 3 Deployment discusses packaging EJB and persistence modules, assembling modules in different ways into an enterprise archive. If you have developed enterprise applications, this should be old news to you.
CHAPTER 12: EJB 3 Client Applications takes you into the JSF architecture and concepts, and focuses on integrating JSF user interface components and the JSF navigation model with the EJB 3 back-end application that was developed in Chapter 7.
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.
While the material covered in this book is outstanding, there are more mistakes than I would expect in the samples. On the other hand, the authors do have a link on the Apress web site for corrections. While working on the examples, I recommend you have a printed copy of these corrections. I would recommend this book to developers who want to migrate to EJB3 or those who want to build applications using this new simplified EJB3 architecture.
| Relevance | |
|---|---|
| Readability | |
| Overall | |