I understand the difference between jpa, hibernate. need to understand JPAHibernate and hibernate differences.
-
I know the programatical difference. please help out in understanding conceptually – Kathiresan. N May 17 '19 at 05:29
2 Answers
That's simple:
JPA is the Java Persistence API specification and defines an interface.
Hibernate is a JPA implementation.
That's it. The important point is that Hibernate has more features than JPA because the JPA standard covers a common set of features that all JPA implementations have to implement.
Additionally Hibernate is older then JPA and has it's own interface. But Hibernate committers are recommending using the JPA interface where ever possible.

- 34,053
- 5
- 48
- 82
-
Thanks...i know this but my actual question is on https://stackoverflow.com/questions/15002481/difference-between-hibernate-and-hibernate-jpa... this is actually need to understand – Kathiresan. N May 17 '19 at 11:06
-
i need to understand jpahibernate library is different from hibernate right...if hibernate is implementation of JPA, what is JPAHIbernate? diff between JPAHibernate and hibernate , library wise both differ, but conceptually how to differentiate this... pls dont say jpa is spec and hibernate is implementation, i need diff between hibernate and JPAHibernate – Kathiresan. N May 17 '19 at 12:28
Hibernate is an implementation of an ORM that can be accessed either via its own API (Hibernate) or via JPA interface (JPA Hibernate). More info.
Hibernate was created in 2001, while JPA was created in 2006. I guess the term JPAHibernate appeared when it first implemented JPA.
@org.hibernate.annotations.Entity
is special: It allows to add parameters not available in JPA annotaion. Quoted from doc:
Note
@javax.persistence.Entity is still mandatory, @org.hibernate.annotations.Entity is not a replacement.
-
HI Thanks @Benoit, To ensure that you are using JPA, only include classes/annotations from java.persistence. Do not include anything from org.hibernate (or, if you want just to use Hibernate, do just the opposite). – Kathiresan. N May 21 '19 at 11:30
-
This is a line taken from below link : https://stackoverflow.com/questions/15040583/relation-between-jpa-and-hibernate-annotation – Kathiresan. N May 21 '19 at 11:33
-
My pointis that if i use Org.hibernate.entity annotation table will not created in DB, so is this correct? and also @ID comes from persistence pkg only – Kathiresan. N May 21 '19 at 11:35
-
-
hi benoit, i saw ur explonation, my question still exist, hope u read the line which i took from the link you gave, if not below is the line, This is a line taken from below link : https://stackoverflow.com/questions/15040583/relation-between-jpa-and-hibernate-annotation ..... if hibernate is used then why do we have to usejpa pkg, cant u create table using hib @entity annotation? Assuming jpa didnt exist, will table be created using entity – Kathiresan. N May 26 '19 at 09:21
-
No you cannot use this annotation alone, this is written in my answer. Using Hibernate through JPA will make the migration to another ORM easier. – Benoit May 27 '19 at 07:42
-
I accept it. but have u read the line saying if uuse hibernate donot use jpa...some thing written in tht link. okay comming to the point, i understood whatever you say.but my question is if i use hibernate alone, assume that thiswas before existence of JPA, was that annotation created table(org.hibernate.entity) – Kathiresan. N May 27 '19 at 13:08
-
https://stackoverflow.com/questions/15040583/relation-between-jpa-and-hibernate-annotation....this link says **` To ensure that you are using JPA, only include classes/annotations from java.persistence. Do not include anything from org.hibernate (or, if you want just to use Hibernate, do just the opposite). `** pls comment only on this...i understand migration etc, loosely coupled.... – Kathiresan. N May 27 '19 at 13:08
-
Well it's just that JPA and hibernate annotations have similar names so it's easy to pick up JPA one instead of an hibernate one (and the other way round). I guess that's the purpose of this comment. – Benoit May 27 '19 at 13:32
-