Civil discussions on EJB 3.0 and JPA adoption

Tonight I was browsing the blogsphere for discussions on EJB 3.0 and JPA adoption. To be honest, I am still a bit uncertain whether the path I have chosen is the best path for my career, long term. I was quite pleased to find some discussions about EJB 3.0 and JPA indicating that it is far from dead, and is growing.

First up is a very very long thread on TheServerSide.com. It will probably take you an hour to read all of it. What's great about this thread is that it is very civil. Some of these guys are Spring users, pro Spring, but also pro Java EE, EJB 3.0 and JPA. Here are a couple of highlights:

Bill Burke:
  1. EJB3/JPA is more prevalent than the Spring community would lead you to believe.
  2. That Spring is not as prevalent as the Spring community would lead you to believe. (That's not saying it isn't prevalent, but claims like "Spring is the defacto Java EE" are just silly).
Solomon Duskis:

The Spring and Hibernate "story" is compelling to developer who want a job in the next couple of years. The Spring and Hibernate story is compelling to conservative development institutions who care about service and a talent pool. I would say that those two populations have a much stronger reason to use Spring.

However, I definitely agree that EJB3 is gaining momentum and is a great choice for a platform...

Gerard Fernandes:

Session EJBs provide a container-configurable, easy to integrate, service abstraction. In a clustered, high-availability J2EE application, the easy integration (clustered, load-balanced/fail-over) of a Session EJB as a service is simply unbeatable by Spring. Of course you could do the same with Spring - just not as easily.

"why should I give up my technology, I like it." Your response was "because your technology sucks."

This reminds me of my brief encounter with Rod Johnson at JavaOne 2007. I told him that I'm relatively new in the Java world (a couple years) and chose to go the Java EE 5 standards route instead of Spring & Hibernate. I asked for his honest unbiased opinion why I find it difficult to meet developers that use EJB 3.0 and JPA. He told me that he finds it hard to be unbiased, then gave me some reasons.

  1. EJB3's dependency injection totally sucks.
  2. Everyone is using Spring.
  3. I'll make more friends and be more popular if I use Spring.

Then he walked away. Someone from TheServerSide.com was there listening to our conversation and bursted out laughing. He said that my question was the funniest thing he has heard all week, then went on to tell me that Spring is the new Java EE.

Months later Rod Johnson announced that Java EE 6 gets it right, and that Interface 21 is joining the JCP to work on Java EE 6. This was big news for everyone. I sincerely hope that he will help put an end to the Spring IoC vs EJB wars among developers, just like JPA has done for EJB CMP vs Hibernate vs JDO etc.

Tonight I found Bill Burke's blog entry calling on Interface 21 to bring Spring IoC to Java EE 6 to do just that (end the wars). The comments were very interesting to read. Marc Fluery, founder of JBoss, got involved in the discussion too.

Since I don't plan to be hunting for a job within the next couple of years, I think that it is safe for me to focus on Java EE 5/EJB3/JPA today, Java EE 6 when it comes out, and within a few year time these kinds of discussions will be forgotten. Maybe one day we'll see Spring as the EJB 3.1 provider in some application servers like we can find Hibernate and TopLink as JPA providers today.

If you ask me, the reasons why Java EE 5, EJB 3.0 and JPA aren't wildly popular yet are:

  1. A lot of companies are using WebSphere, which to date STILL doesn't have support for EJB 3.0. That "addon" is in beta, and developers are stuck with J2EE 1.4.
  2. It wasn't until recently that BEA WebLogic and Apache Geronimo released support for Java EE 5. Glassfish wasn't a viable option for production environments until last Monday (Sept 17 2007) when Glassfish V2 was officially released.
  3. Spring and Hibernate solved a problem really well, and developers don't have a compelling reason to switch back to Java EE standards. Their view of "standards" is tainted and they don't mind using non Java EE libraries.
  4. There are still things that Spring IoC and Hibernate do better than EJB 3.0 and JPA. Hopefully the gap will be closed in Java EE 6/EJB 3.1/JPA 2.0

Update: It looks like the WebBeans JSR is the Java EE 6 answer to Spring IoC. It is based on the Seam component model and Guice, designed for POJOs and EJBs. Last month I read a book on Seam because I knew the component model was being standardized. Check out these sneak peaks from Gavin King: part 1, part 2, part 3. If there is a demand for this technology outside of Java EE environments then it may be brought to Java SE in the future.

Comments (3)

Comments:

It is unquestionable that Spring and Hibernate solver many issues but as EJB becomes more and more mature and the popularity of Glassfish I believe JEE will become popular solution.

Posted by Kenneth Mark on September 20, 2007 at 11:39 PM EDT #

I've kind of been in a similar position as you over the past several months. From the future job perspective, do you go hibernate and spring, or go, in my case, JEE 5 with Seam. Alternatively, do you just forget the whole thing and go .net?

For me, Seam was a big attraction since it solves a lot of the problems of web development which is especially important for inexperienced web developers. Of course, it does also introduce its own problems.

Spring is the new J2EE has been a catchphrase for the past year or so, but not so much any more. Spring has had to do a 180 on the whole 'stateless is good' philosophy when they realized everyone wants to do ajax, and therefore there would be multiple requests / responses per user interaction.

In my mind, the simplistic answer was that I need a stateful framework, but something more sophisticated than slapping a bunch of objects in a session resulting is massive user sessions and scalability problems. EJBs, and especially with the Seam project seems to answer the problem gracefully. Controlled statefulness with a finite existence.

Posted by Delphi's Ghost on September 24, 2007 at 11:44 PM EDT #

Thanks for the comment. I didn't mention Seam, but I have chosen to use Seam + facelets as well. It "fixes JSF" in a way that is being standardized in Java EE, so the time and work effort I have invested in Seam is not wasted. When Java EE 6 comes out it should be relatively easy to update my skills and code.

Posted by Ryan de Laplante on September 25, 2007 at 02:43 AM EDT #

Post a Comment:
Comments are closed for this entry.