What are the main differences between EJB 2.0 and EJB 3.0 in the orientation of an object

26,887

Solution 1

Major difference between EJB 2.0 and 3.0 are listed below in theory

  1. Elimination of home interface gives simpler lookup process in EJB 3.0 than in EJB 2.0.
  2. Employment of annotations makes EJB 3.0 a latest technology while the EJB 2.0 has home and remote interfaces instead of annotations.
  3. EJB 2.0 deploys entity beans for accessing database. EJB 3.0 has Java Persistence API to access data which is generalized to address issues of portability.
  4. EJB 3.0 performs better because it uses POJOs along with metadata annotation, a new introduction. The POJOs are faster than XMLDescriptor and JNDI deployed by EJB 2.0 for reference of objects. EJB 2.0 does not implement POJO.
  5. EJB 2.0 is heavy when it comes to writing home and remote interfaces. EJB 3.0 has no restriction on using any of the standard interfaces. It is a well configured and simple POJO which doesn’t need to execute container callback methods such as ejbActive, ejbStore, etc which are used by EJB 2.0.
  6. In EJB 3.0, entity bean can be effortlessly converted to DAO and vice versa. This is not possible in EJB 2.0.
    Hope this might help to some extent

Solution 2

You are right, these are the main differences between EJB 2 and 3. Generally EJB 3 took all the best from lightweight injection frameworks like Spring and made EJB as close as it is possible to regular POJO.

However today, in the middle of 2013, why do you want to know the difference between EJB2 and EJB3? EJB2 is obsolete. Learn version 3.x, forget about the older versions. Learning EJB 2 these days is exactly like learning horse riding prior to learning car driving because people used to use horses as a transport before invention of cars.

Share:
26,887
Avraam Mavridis
Author by

Avraam Mavridis

https://avraam.dev/

Updated on January 15, 2020

Comments

  • Avraam Mavridis
    Avraam Mavridis over 4 years

    I want to try EJB and I am studying the theory behind EJB 3.0. I know that in EJB 3.0 you don't have to use deployment descriptor but you can use annotations, and also you don't have to write Home and Remote Interfaces.

    Are there any other key difference in the object orientation between EJB 2.0 and EJB 3.0?