PeakGen
PeakGen

Reputation: 23035

Hibernate vs JPA

I am asking this question because I am totally confused. Someone I know asked me to rate my JPA knowledge and Hibernate experience. As I know, JPA is a specification, while Hibernate is an implementation of it, so I can rate Hibernate exp not JPA. Or else, is there something I am missing?

Upvotes: 0

Views: 447

Answers (4)

Harun ÇETİN
Harun ÇETİN

Reputation: 89

  • JPA is a set of a specification which implementation is provided in Hibernate.
  • JPA is a standard, while Hibernate is not.
  • In hibernate, we use Session for handling the persistence of data, while in JPA, we use Entity Manager.
  • The query language in Hibernate is Hibernate Query language, while in JPA, the query language is Java Persistence query language.
  • Hibernate is one of the most JPA providers.

Upvotes: 0

Shiv Gopal
Shiv Gopal

Reputation: 569

JPA Annotations:

  • are defined by JSR 317
  • provides the standard API on which ORM Vendors (like hibernate) should base their implementation.
  • Packaged in javax.persistence

Hibernate implements JPA specification.

Hibernate Annotations does following additional:

  • provides features beyond specified in JPA.
  • Couples the application to Hibernate(caution: if you are using hibernate annotations then you are tightly coupling/using hibernate, its not straight forward to replace hibernate with other ORM tool). – Packaged in org.hibernate.annotations.

Thanks,

For other interesting blog posts visit - http://javaho.wordpress.com

Upvotes: 0

Emrah Akgül
Emrah Akgül

Reputation: 630

JPA: set of interfaces which specifies how Java objects should interact with database. Set of interfaces also means that set of corresponding functions which have to be implemented.

Hibernate: is an implementation of JPA. It takes JPA interfaces and implements corresponding methods.

There are also other JPA implementations like OpenJPA etc. These are similar to Hibernate, they take JPA and implement it.

By the way, there are additional features of Hibernate, so it can be concluded that Hibernate not only implements JPA, but also has additional features.

Upvotes: 1

wawek
wawek

Reputation: 1597

Hibernate implements JPA specification but what's more Hibernate adds some more features in its API. So you can have experience in JPA but you don't have any knowledge about Hibernate additional features. That's what I understand.

Upvotes: 3

Related Questions