What is the difference between EJB3.0(CMP) and Hibernate

Showing Answers 1 - 5 of 5 Answers

HIBERNATE is an ORM ( Object-Relational-Mapping) technology. It is an Open-Source and free technology , developed in SourceForge.net. Theoretically, the EJB specification does not say anything about the method to be adopted in persisting objects for permanent storage and retrieval. It could be simple object serialization.EJB 3.0 has fully embraced Java Annotations introduced in JDK 5.0 and also simplifies the API for CMP entity beans by using Hibernate as the EJB 3.0 Java Persistence engine.

  Was this answer useful?  Yes

sony vgeorge

  • Apr 4th, 2007
 

In hibernate we have .hbm file where we do all the relational things for our application. Each and every pojo (plain java object) we have to specify one .hbm file. it should make some complication if it is a huge project.

In Ejb3.0 we avoid all the hbm file and had taken the approch of annotaion. so we can understand the concept of every pojo easily without refering any other configuration page (In hibernate we have to check .hbm file to know the relation).

  Was this answer useful?  Yes

VAMSI MOHAN

  • Aug 31st, 2007
 

1. You can use Hibernate without a full J2EE Containter. But EJB couldn't.

2. Hibernate uses OR Mapping and POJO for persistance. But EJB uses entity beans for persistancy.


3. Hibernate facilitates to work with any Database without changing code. But in case of EJB, sometimes it may be required.

EJB3.0 does provide the POJO features for ORM in JPA as well as all features of older version, in other word we can say that Entity Bean is no longer in EJB, to provide the same, specification is providing the more strong technology called JPA (Java Persistence API). JPA is an ORM tool which has entity to relation binding like Hibernate with Annotation or with XML configuration. Its older feature like concurrency, Transaction, Security etc is same like earlier. It could be deployed on Application server, web server, and on Stand alone application as well with user controlled transition.

  Was this answer useful?  Yes

kumarsamba

  • Dec 5th, 2009
 

The basic difference is EJB needs an application Server for its implementation whereas Hibernate needs only a web server for its implementation.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions