0

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?

PeakGen
  • 21,894
  • 86
  • 261
  • 463
  • 2
    I fail to see a coding question here? – mabi Oct 22 '15 at 08:19
  • 3
    @mabi: You didnt fail. I didnt add code – PeakGen Oct 22 '15 at 08:20
  • There are 2 flavours of Hibernate: Hibernate ORM & Hibernate Entity Manager (which is an implementation of JPA specification). Initially, Hibernate was developed as Hibernate ORM, which has `Session` (think of it as `EntityManager` in JPA). It's your task to ask what implementation of Hibernate are they referring to. – Buhake Sindi Oct 22 '15 at 08:22
  • Ok, while I don't think this question should be on SO specifically (maybe Workplace if you frame it right?): you can have knowledge on the spec document w/o having used any implementation. As long as you're aware of the parts of Hibernate that are a deviation from the standard, you should be good to equate the two. – mabi Oct 22 '15 at 08:22
  • JPA is actually more of an API, part of a specification. You can't download and use it, but it is definitely something programmable. So to say. Very much the same as Hibernate, which also happens to be an implementation. – Gimby Oct 22 '15 at 08:24
  • @BuhakeSindi: I used `Sessions` which means I used ORM – PeakGen Oct 22 '15 at 08:24
  • 1
    @mabi Not every question needs code. – chrylis -cautiouslyoptimistic- Oct 22 '15 at 08:25
  • @Gimby: Basically, knowing Hibernate (`sessions` system) means you "might" know JPA or you "might" not know. right? – PeakGen Oct 22 '15 at 08:27
  • 3
    Possible duplicate of [What's the difference between JPA and Hibernate?](http://stackoverflow.com/questions/9881611/whats-the-difference-between-jpa-and-hibernate) – Szarpul Oct 22 '15 at 08:29
  • @Tracer When you searched "hibernate vs jpa" in Google (or whatever search engine you prefer), why did any of the answers (hundreds of them all answering your question) not suit you? Update the post with it, otherwise this question will get closed in minutes as being a duplicate. Don't blame SO moderators later; if you are not eager to get an answer to your question, the community will not be either. – Dragan Bozanovic Oct 22 '15 at 08:33

4 Answers4

3

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.

wawek
  • 1,577
  • 1
  • 13
  • 23
  • Yes, "Hibernate experience" means what do you know about Hibernate specific features and configuration. Even if you use JPA through Hibernate, you might not know anything about specific Hibernate features. – Gaël J Oct 22 '15 at 08:23
  • Basically, knowing Hibernate (sessions system) means you "might" know JPA or you "might" not know. right? – PeakGen Oct 22 '15 at 08:27
1

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.

Emrah Akgül
  • 630
  • 2
  • 7
  • 18
0

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

Shiv Gopal
  • 539
  • 2
  • 10
  • 21
0
  • 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.
Harun ÇETİN
  • 81
  • 1
  • 4