tags:

views:

393

answers:

5

I am gonna start learning EJB. I just need your suggestion on picking the version for learning EJB 2.0 or EJB 3.0. Is it good idea to start with EJB 2.0 and migrate to EJB 3.0? If it is, can it be easy to migrate? Actually I am holding Head First EJB book covering version 2.0. Suggest me any other good book, that I can stick to it for complete learning of EJB.

I am very grateful to you if you help me in becoming EJB Guru

+2  A: 

I'd strongly recommend learning EJB 3.0 vs. EJB 2.0. It follows similar patterns to the popular ORM Hibernate. I don't believe there's much value in learning an earlier variant of EJB, when the current version follows commonly used ORM patterns and is supposed to be much simpler. From the FAQ:

The goal of EJB 3.0 is to target ease of development, the main theme of the Java EE 5 platform release. EJB 3.0 is a major simplification over the APIs defined by the EJB 2.1 and earlier specifications. The simplified EJB 3.0 API allows developers to program EJB components as ordinary Java objects with ordinary Java business interfaces rather than as heavy weight components. Both component and client code are simplified, and the same tasks can be accomplished in a simpler way, with fewer lines of code. Because it is much simpler, EJB 3.0 is also much faster to learn to use than EJB 2.1.

Since the two versions are so different, migration is next to impossible beyond the most basic concepts. Unless you have a specific requirement such that you need to look at EJB 2.0, check out the latest variant.

Brian Agnew
A: 

This is a good book on learning JavaEE. Though without EJB: http://www.amazon.com/Expert-One-One-Development-without/dp/0764558315.

Do you have a good reason to need EJB specifically or JavaEE?

Nathan Feger
That book is rather dated now. It's the basis for Spring. If you want to learn Java EE without EJBs, learn Spring 2.5.6 or 3.0 RC well.
duffymo
+1  A: 

I think you should start with EJB 3.0, unless you have strong feelings that you need 2.1. Those are completely different worlds.

kubal5003
+1  A: 

I would recommend learning EJB 3.0 first since it has quite a few improvements and simplifications, and then only learning EJB 2.0/2.1 if you need to.

Kaleb Brasee
+1  A: 

You definitely want to learn EJB 3.0 over 2.x. The programming model was substantially improved and simplified. Richard Monson-Haefel's Enterprise JavaBeans 3.0 (Fifth Edition) is pretty highly regarded.

Scott Leberknight blogged about his shock at how difficult it was to go back from EJB 3.0 to legacy EJB 2.1 code.

But @Nathan Feger brings up a good point. Many are moving from EJB to other approaches, both Java EE and non-Java EE based. Even Richard Monson-Haefel now thinks they're in decline. Another indicator cited to support this position is that the Spring Framework recently overtook EJB on job site indeed.com and is now seemingly twice as desirable. There was a lot of pushback from Java EE defenders when RMH's podcast came out though, so you should study both sides of this issue and decide for yourself where to focus your personal development efforts.

Jim Ferrans