When I was interviewed for my current position about three years back one of the interviewer asked me “Is EJB still alive”? My answer was "EJB is still thriving and is going to be for long haul". The interviewer laughed at my answer sarcastically and was of opinion that EJB is dying and said hope it leaves beyond J2EE 1.3. EJB is still thriving after three years and again going for a major overhaul with a premise that EJB is indeed still alive. I attended a session titled “J2EE without EJBs” presented by Rod Johnson in the TSS symposium where he shunned EJBs and tried to promote “Springs framework” and case for lightweight containers. He had a great start with outlining the drawbacks for EJBs but eventually the presentation ended as an evangelism for his framework. He trivialized the usage of EJBs and he limited J2EE to only web applications. At least 18-20 per cent of J2EE applications still use standalone Java clients. Thousands of customers leading application server vendors BEA, IBM and Oracle use EJBs successfully in their production applications. The reality is that I see more and more customers are using EJBs and thus by cautiously evaluating it’s need.
However I agree with his arguments that EJBs are complex for developers and have to be simple. This is certainly promising that EJB expert committee has realized the complexity and is trying to address these issues with EJB 3.0. Please take a look at my article EJB 3.0 looks simply great for details about EJB 3.0. (http://radio.weblogs.com/0135826/2004/05/07.html#a24)
Has EJB has done more harm than good for J2EE and the community ? My big answer is “No”. I would say EJB has dramatically changed the distributed computing model and in my opinion J2EE probably would not have existed without EJBs and we still have been struggling with CORBA. EJB and CMP were attractive for every application and in my experience developers used EJB or CMP excessively when these were not all required. So you have to judge whether you really need EJBs in your applications.
Often people mistakenly consider entity beans as heart and sole for EJBs and this perception is completely wrong. You have to remember that EJBs are not just for persistence. EJB is the only technology in the J2EE that provide declarative transaction, security, and inter-operability with CORBA applications, timer functionality and so on. In his presentation Rod changed his tone half way and recognized that session beans and MDBs are good but termed entity beans as evils. He made an argument that Entity beans are cause of enterprises abdandoning J2EE and gracing .NET platform. He suggested people should use open source O-R frameworks or JDO for all applications. Interestingly he did not suggest products like TopLink that has been proved in the market for years so I really doubt how much experience he has in building really scalable applications because still most of the large organizations hesitate to use open source frameworks in really large applications. So I would not take his advise seriously however I would be waiting to read his latest publication. BEA would have gone out of business long time back if entity beans do not perform or scalable. Entity beans have successfully really being used in productions by many large applications in high transaction applications.
It was not too appalling to note that Rod did not like the changes being made in EJB 3.0 because it will make the lightweight persistence frameworks and may be spring framework obsolete!
However I’m pleased to learn that EJB 3.0 committee is progressing well in their proposals and plans to have EJB 3.0 production within a year. That will resuscitate EJB and will make darling for the mainstream developers and there will not be a need to ask the question again.