Reputation: 42957
I am pretty new in Java ORM world and I have some doubts related to the relationships and differences that occurs between JPA 2 and Hibernate.
Reading the documentation it seems to me that JPA2 is a specification while Hibernate is a specific implementation of this specification. Is it true? What exactly means that JPA 2 is a specification? What is a specification? I think that it provide some interfaces (or something like these) where are definied common required behavior to perform operation on a DB (such as: insert, delete, select, upodate operations, etcetc).
So I think that JPA2 provide a list of common operation and the not implemented method to perform it and an ORM framework like Hibernate implements it.
Is it true or am I missing something? So it means that I can't use JPA 2 in a sort of standalone version because it have not implementation but at the same time I can use Hibernate as a standalone tool (whitout using JPA)?
So it seems to me that I can use Hibernate in both standalone and bound to JPA 2?
So it means that I can annotate my class using JPA 2 but if I don't use also one of its implementation nothing happen?
What exactly is the benefit to use Hibernate bounded to JPA 2. I think that it is something related to the standardization and to the possibility to swap out Hibernate and replace it using another implementation without do changes to my code. But what are the main difference using Hibernate in standalone version and bounded to JPA 2? JPA 2 provide me some more feature or limits me respect compared to the use of the Hibernate standalone version? Have I less features?
Tnx
Upvotes: 1
Views: 358
Reputation: 68
In simple terms - JPA is is an interface, while Hibernate is its realization. So the best way is to use JPA 2 annotations - in this case rule Code against an interface, not an implementation applies.
Upvotes: 1