Hibernate和Hibernate JPA之间的区别 [英] Difference between Hibernate and Hibernate JPA

查看:143
本文介绍了Hibernate和Hibernate JPA之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了很多类似的问题

I found a lot of similar questions

  • Difference between Hibernate library and Hibernate JPA library
  • What's the difference between JPA and Hibernate?
  • similarity and difference between jpa and hibernate

但没有人回答我的下一个问题。使用 org.hibernate.SessionFactory 和JPA javax.persistence.EntityManager 实现的经典hibernate方法有何不同?我听说,这个JPA实现使用 org.hibernate.SessionFactory 并且像包装一样工作,是真的吗?

but no one answers my next question. What diference between classical hibernate approach using org.hibernate.SessionFactory and JPA javax.persistence.EntityManager implementation? I heard, that this JPA implementation uses org.hibernate.SessionFactory and works like wrapper, is it real?

推荐答案

确实。

JPA只是一个允许您从使用的持久层中抽象出来的API。 Hibernate提供 EntityManager 接口的实现,该接口充当适配器 - 它使用与hibernate相同的基础方法 SessionManager

JPA is simply an API that allows you to abstract from the used persistence layer. Hibernate provides an implementation of the EntityManager interface that acts as an adapter - it uses the same underlying methods as a hibernate SessionManager.

例如,您可以将实现切换到Eclipse Link和不必更改任何源代码。

The idea is that you could, for example, switch your implementation to Eclipse Link and not have to change any of your source code.

这篇关于Hibernate和Hibernate JPA之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆