Over a million developers have joined DZone.

Debu Panda on "EJB3 in Action"

· Java Zone

Microservices! They are everywhere, or at least, the term is. When should you use a microservice architecture? What factors should be considered when making that decision? Do the benefits outweigh the costs? Why is everyone so excited about them, anyway?  Brought to you in partnership with IBM.

The main purpose of Enterprise JavaBeans (EJB) 3.0 was to improve the EJB architecture by reducing its complexity from the developer's point of view, which it has. EJB3 in Action makes it even easier to build applications written using the Enterprise JavaBeans architecture which are scalable, transactional, and secure. In this interview, Debu Panda tells us more about the book, and also about EJB2 and Spring as well.

[img_assist|nid=2361|title=|desc=|link=none|align=left|width=100|height=75]1.Debu, tell us something about yourself. Who you are, where are you located, and what kind of work do you do?

I work for Oracle and my current responsibility includes product strategy for Oracle's middleware management functionality for Oracle Enterprise Manager product. Prior to this role, I worked as product manager for Oracle's J2EE offering (OC4J) for about six years and led Oracle's Java EE 5 / EJB 3 implementation. I recently moved to India and live in Bangalore. I'm a Java enthusiast and have written over 30 articles on enterprise Java and SOA technologies. Also I'm the lead author of EJB 3 In Action. I regularly blog on middleware technologies at http://debupanda.com.

2. Why did you decide to write a book on EJB's?

I decided to write a book on EJB 3 for three primary reasons. First, EJB 2 had very poor peception in the marketplace that needed to be improved when it underwent the transformation to a much more simplified programming model with EJB 3. While many well-known Java luminaries were bashing EJB – there was a need for a good book on EJB 3 that looks at the problem space in a more objective manner. Secondly most of the EJB books on the market require some sort of prior knowledge of Java EE or EJB. We wanted to write a book to that appeals to novice readers and help them progress to more experienced developers. Finally, most of the EJB books just rehash the spec and do not provide any guidelines, best practices, nor do they discuss integration with popular frameworks such as Spring. I wrote a few articles on EJB 3 in the past and Manning contacted me to lead this effort. . Reza Rahman and Derek Lane joined later and provided a lot of support to complete the book.

3. As far as I know "EJB 3 In Action" got very good reviews from Javalobby. How is it being received by the audience elsewhere?

Yes, we are getting rave reviews from most of our readers. Beside 3 different JavaLobby reviewers gave us FIVE STAR rating, JavaRanch gave us nine shoe horses. We have gotten good reviews from many people in the blogosphere. It is also being translated to Chinese and Portuguese.

4. When I reviewed the book for Javalobby, I mentioned that there were some very good analogies and illustrations throughout, who came up with these?

It was a combined effort. Some of the analogies came from me, others,came from Reza. For example, comparison of EJB 3 with three incarnations of Sadhu was my concept, however, the airplane analogy was from Reza.

5. What is your favorite chapter and why?

It would be difficult to identify a single chapter. However, I like chapter 13 (Taming Wild EJB) the most. Also I like chapter 16 (EJB 3 and Spring) very much. These two chapters required most experimentation and chapter 13 provide a lot of advise to readers to tune EJB 3 and JPA based applications.

6. How much time did you spend on writing your part?

Actually, I was involved from beginning to the end. The way we divided the work is I came up with the first technical draft for all chapters and Reza and Derek helped improvise/rewrite the chapters. Reza's work is really commendable in first nine chapters and some of the appendices.Finally I take a look and make sure things fall together nicely. I spent more than a year working on this book – mostly nights and weekends.

7. Even though EJB 3 has simplified development of enterprise applications, I still see a lot of resistance from developers when they hear the word EJB. How do you convince them that this version is completely different from the earlier ones?

Yes, it was a tough sell initially. Many developers are so disillusioned with EJB 2 that they do not want to hear about EJB 3. Therefore, when we broach the subject with customers we ask about their pain points and explain how EJB 3 addresses these issues. We discuss this quite a bit in chapter 1. This chapter is available for free at Manning web site (http://manning.com/panda).

8. Has Java EE 5.0 really simplified development?

Yes, actually to some extent. EJB 3 and JPA greatly simplified development of enterprise applications. JPA simplified and standardized development of applications using O-R frameworks. All leading O-R frameworks such as JBoss Hibernate, Oracle TopLink and JDO products such as BEA Kodo are JPA compliant providing lot of options to users. With EJB 3, building a server side application is a snap. Every Java developer can now become an EJB developer by learning few annotations. Also JAX-WS greatly simplifies building web service applications. Annotations based dependency injection greatly reduces complexities of using Java EE resources and services. So Java EE 5 is a great step forward. I expect to see the momentum to continue in Java EE 6.

9. Are companies still using EJB2?

Yes, many companies are still using EJB 2 applications. For most companies, generating revenue is more important than underlying technology. Many customers have deployed their applications using EJB 2 technologies and they have achieved their performance and scalability goals so they cannot just throw it away and jump on the EJB 3 or Spring bandwagon. Similarly, many customers who are using an application server such as IBM Websphere in production they cannot use EJB3.

10. If you had to choose between EJB3 and Spring for a new application which one would you choose? Why?

Being one of the author's of EJB 3 and helping to drive Oracle's EJB 3 implementation, I am biased towards EJB 3. I am reminded of Shakespeare's famous "To be or Not to..". In similar vain, to use EJB 3 or Spring is not the real question. I will use whatever makes sense for my business. We discuss these topics at length in EJB 3 In Action. I view both of them being complementary technologies rather than competing technologies and we have explored the possibilities of using them together. Additionally, I wrote a series of articles for JDJ on Java EE 5 and Spring and presented my views at many conferences on this topic.

11. Most developers always think Spring and Java EE as competing frameworks, how do you convince them that Spring and EJB 3 can work together?

I will ask them to read EJB 3 In Action. Actually, throughout this book we discuss when EJB 3 makes sense and when it does not and should Spring makes the most sense. Also I want to highlight that Spring 2.5 has partial support for EJB 3 as a part of Pitchfork project. Therefore, can use some EJB 3 features in Spring framework too.

12. Have you seen a change in the developers mindset about this new latest an simplified version of EJB?

Yes, we do see a lot of changes in most of the enterprise developer's mindset. The JPA specification has been hailed by the entire community. Most of developers like POJO programming model, dependency injection and all great changes that went in EJB 3.0.

13. Can you give us some useful tips and tricks on EJB 3?

It is difficult to give tips on EJB 3 in this format especially considering we wrote a complete book on it. However, the most useful tip is that I can give is to use EJB 3 only when makes sense – do not overuse it. Use stateful session beans sparingly.

Thanks, Debu for this interview!

Discover how the Watson team is further developing SDKs in Java, Node.js, Python, iOS, and Android to access these services and make programming easy. Brought to you in partnership with IBM.


Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}