Vishwanath Krishnamurthi's blog

A blog on Java EE, clean code, open source and TDD

EJB 3.1 Cookbook by Richard Reese – Review

with one comment

Recently, I received a free copy of EJB 3.1 Cookbook, from PacktPub for review.

But I must say that it did not meet my expectations in a lot of ways.

Some had to do with

  • Bad practices given as recipes
  • Lengthy sections on concepts not related to EJB
  • EJB 3.1 Specific features not being highlighted enough.

To explain,

EJB 3.1 Specific features not being highlighted enough:

If you have been following some popular blogs on JavaEE, you’d have already been exposed to some EJB 3.1 features. I fall into that category. And my natural expectation was that, this book would explain those concepts in much more detail. But much to my disappointment, it was the other way around.

 In ‘Packaging the EJB’  Chapter :

I expected to learn about how packaging EJBs was made simpler in EJB 3.1 compared to EJB 3. The most important one being that, it’s no longer required in EJB 3.1 to make an .ear file, and EJBs could now be packaged within WAR.

There’s only a two line description of this, something that a reader could easily miss.The consolidated table in page 348 misses to specify this too.

Instead there was a lengthy explanation on how to archive using the ‘jar’ command in Java, something that I’ve never seen developers doing.

 The Embedded Container:

EJB 3.1 makes testing EJBs easy with the embedded container.  And a team could benefit a lot writing unit tests with this newly introduced API. But there was only a small section on ‘Accessing EJB 3.1 embedded container’.

Wish more examples / more focus on embedded container were present.

Bad practices given as recipes:

EJBs were accessed directly from JSP using scriptlets! Using scriptlets in JSP is considered as a bad practice, something that was done a decade back.

Hundreds of threads in Javaranch explain users of it, and you’d find JSP moderators (like Bear Bibeault ) explaining that often.

Lengthy sections on concepts not related to EJB:

Sections ‘Exception Handling with EJB ‘ and ‘Using Logging with EJB ‘ had nothing to do with EJB after all and merely talked about good practices on exception handling and logging rather than talking about EJB specific exceptions.

I don’t feel the need for a general lecture on “exception handling / logging ” in a EJB 3.1 specific book and if at all, present, I don’t see why it should be in a chapter rather than appendix.

The same about the sections ‘Efficient mainpulation of Strings‘ and ‘How to support Currency

 The good part:

The good thing you’d find about the book is that it is pretty easy to read through, with the sections of the code being discussed, presented in bold.

The language was kept simple, with screenshots and tables when required.

To summarize,

This is a book, that is easy to read. Had it only concentrated only on ‘EJB 3.1’ specific features, in 100 odd pages, it would’ve been a pretty good.

If you wanted a book to get a quick rough picture, in a week’s time, then I’d recommend this. If you had more time, and wanted a book to help you develop a firm understanding of the concepts, I wound not recommend this one.

2/5 Stars


Written by Vishwanath Krishnamurthi

August 8, 2011 at 6:35 pm

Posted in Java EE

One Response

Subscribe to comments with RSS.

  1. Hi i have developed an enterprise application, consisting of an ejb module, web app and also an enterprise client(desktop). I have designed a two fields form that will post to the database. Here’s how my app looks like: EJB container consists of an entity class, as stateful session bean and also a remote bean for accessing it as remote client which consists of my business methods. Then i also did a web service from the session bean i created.

    From my client, i have created a web service client to communicate with the web service deployed on the ejb module. i have also dragged the method that i want to use to my form that i want to send data with. Im getting a null pointer exception.

    It points to this stack trace

    stack trace : private static Registration register(java.lang.String name, java.lang.String surname) { port = service.getRegistrationWSSSPort();
    return port.register(name, surname);


    November 27, 2013 at 1:03 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: