The difference between the Hibernate library and the JPA Hibernate library

On the screen where you can add the Hibernate library to the project, there are two options: Hibernate and Hibernate JPA.

What is the difference between 2? Googling gave no explanation.

+4
source share
2 answers

I found this a good explanation. http://elope.wordpress.com/2007/09/06/difference-between-jpa-and-hibernate/

From the above blog: Therefore, if I need to add a short word:

a) JPA is the Persistence Api that your code should use.

b) JPA Api will transfer the call to the actual viability provider (e.g. Hibernate / TopLink) to do the actual work.

c) If you look at the Performance view, it will depend on the actual life cycle provider (Hibernate / TopLink), and not on the JPA as its only shell layer.

d) If you look at code dependency, JPA makes more sense since your code depends on standard Java Api.

e) If you used Hibernate, you will find that some functions are not available in queries with criteria such as JPA, etc. This does not mean that you cannot request query criteria in your application, you need to get the Session object from the JPA Entity manager and now you are as good as in a sleeping project.

But now your code depends on Specific impl (Hibernate), going forward, you can see more things added in JPA (2.0)

f) If you use JPA: I take it you should, the API is clean, and although you do not need everything you need, it is a good step forward.

+4
source

I don’t know what β€œscreen” means, but in general you can use Hibernate directly (Hibernate API) or as a JPA provider. Since JPA is a standard API, it can encode this API and switch between implementations (Hibernate, EclipseLink, OpenJPA, ...). When using the Hibernate API you are tied to this, but you can use functions that are not standardized by JPA.

+1
source

All Articles