Meaningless Drivel is fun!*
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
Author

What's the difference between Hibernate and JPA?

Matthew Vahedi
Greenhorn

Joined: Jan 05, 2012
Posts: 16
Hi,

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.

Cheers,
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10046
    
163

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
Marshal

Joined: Mar 22, 2005
Posts: 41508
    
  53
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 :-)


Ping & DNS - my free Android networking tools app
 
wood burning stoves
 
subject: What's the difference between Hibernate and JPA?