简体   繁体   中英

Difference between Hibernate library and Hibernate JPA library

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

What is the difference between the 2? Googling did not provide an explanation.

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

From the above blog: So if i need to put in Concise words:

a) JPA is Persistence Api which your code should use.

b) JPA Api will pass on the call to actual peristence provider (ex:Hibernate/TopLink) to do the actual work.

c) If you are looking from Performance prespective ,it will be dependent on actual peristence provider (Hibernate/TopLink) and not on JPA as its just a wrapper layer.

d) If you are looking from code dependency prespective ,JPA makes more sense as your code is dependent on standard Java Api.

e) If you have used Hibernate then you will find that certain features are missing in JPA like criteria queries etc.This does not mean that you can't write criteria query in your application, you need to get Session object from JPA Entity manager and now you are as good as in hibernate project.

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

f) Should you use JPA: My take is you should ,API is clean and although not everthing you need is their but is a good step forward.

I don't know what "screen" you mean, but in general you can use Hibernate directly (Hibernate API) or as a JPA provider. As JPA is a standard API one can code against this API and switch between implementations (Hibernate, EclipseLink, OpenJPA, ...). When using Hibernate API you are tied to this but you can utilize features that are not standardized by JPA.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM