File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes EJB3 vs Hibernate vs Toplink vs OpenJPA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB3 vs Hibernate vs Toplink vs OpenJPA" Watch "EJB3 vs Hibernate vs Toplink vs OpenJPA" New topic

EJB3 vs Hibernate vs Toplink vs OpenJPA

Billy Vandory
Ranch Hand

Joined: Mar 23, 2010
Posts: 57
When people refer to EJB3 entity beans, are they refering to a particular implementation? Or does EJB3 entity bean refer to the JPA implementation such as Hibernate ?

I see a lot of posts which have the title "Hibernate vs EJB3" well, are they competing products, or??

Can someone explain this to me? Does EJB3 Entity compete with Hibernate?
or ??

Billy thanks you

Raf Szczypiorski
Ranch Hand

Joined: Aug 21, 2008
Posts: 383
EJB3 entity beans mean JPA beans. As such, this is 'just' a specification of the API, behaviour, semantics. JPA by itself is not usable, it requires someone to implement the specification. Such implementations (called JPA providers) are: Oracle TopLink Essentials* (reference implementation of JPA1), Hibernate (JPA1 and JPA2 recently with HB 3.5), EclipseLink (JPA1 and reference implementation of JPA2, TopLink donated by Oracle to Eclipse). There are others. Different implementations are used in different application servers: Glassfish v2.1 uses TopLink Essentials, JBoss uses HIbernate, Glassfish v3 uses EclipseLink. The idea is that you write your application against interfaces on GF 3 and then you are able to deploy and use it in JBoss AS 6, for instance - this requires that you don't use any provider specific functionality. If you do, you would have to bundle the provider with your application or simply rewrite parts of the app for the new runtime.
When comparing EJB3 vs. Hibernate, people mean JPA vs. Hibernate native API. Hibernate native has much functionality that didn't make it to JPA (EclipseLink as well), so if you need it, you might consider 'jailbreaking' from JPA. All project that I was on started with JPA, and if necessary breaked out (but not often).

* TopLink and TopLink Essentials - TopLink was a product by Oracle (as such I think it was closed source, but I am not sure), TopLink Essentials was an Open Source subset of TopLink that restricted itself to only implement what JPA requires. TopLink was later donated to Eclipse and is now an Open Source product under the name EclipseLink, and serves as the reference implementation for JPA2. It is worth checking out.

Hopefully this clears some of your doubts.

I agree. Here's the link:
subject: EJB3 vs Hibernate vs Toplink vs OpenJPA
It's not a secret anymore!