File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes What's the difference between Hibernate and JPA? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "What Watch "What New topic

What's the difference between Hibernate and JPA?

Matthew Vahedi

Joined: Jan 05, 2012
Posts: 17

I'm confused! somewhere I read that JPA is part of EJB 3.0 specification and Hibernate implements JPA, then in other places people talk about whether to choose JPA or Hibernate!
Can someone please shed light on these definitions?

Thanks in advance.

Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

Hibernate is an implementation of the JPA spec. Hibernate (and even other implementations) in addition, also provide implementation specific features.

When people say whether to use Hibernate or JPA, I think they mean whether to use implementation specific features or whether to just stick with the portable JPA API features.

[My Blog] [JavaRanch Journal]
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
JPA is an API, while Hibernate is an implementation of JPA. Other implementations (like OpenJPA and EclipseLink) exist as well. The benefit of using the JPA API is that you can choose between these different implementations.

What people mean by "Hibernate vs. JPA" is that Hibernate also implements its own API, which is separate from JPA. It can do some things that JPA can't, but using it ties you to Hibernate.

Edit: ... what he said :-)
I agree. Here's the link:
subject: What's the difference between Hibernate and JPA?
jQuery in Action, 3rd edition