Spring数据是否需要休眠 [英] Spring data required hibernate or not

查看:32
本文介绍了Spring数据是否需要休眠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对spring数据的实现有一个疑问,对spring数据有基本的了解.我了解 JPA 和 Hibernate,它是如何工作的.Hibernate 提供了 JPA 的实现.我的问题,我们能否单独使用 Spring 数据将数据持久保存在 mysql 中,或者我们需要一些提供者,如 hibernate 或 toplink 等用于中型应用程序

I have one doubt about implementation of spring data, have basic knowledge about spring data. I understand JPA and Hibernate, how it work. Hibernate provide the implementation for JPA. My questions, Can we work alone with Spring data to persist data in mysql or we need some provider like hibernate or toplink etc for midsize application

推荐答案

结构如下:

Spring Data JPA
       |
      JPA
       |
   Hibernate

您需要 Hibernate 作为 JPA 实现,但从您的角度来看,您应该只看到 Spring Data JPA.

You need Hibernate as an JPA implementation, but from your perspective you should only see Spring Data JPA.

在设计实体时,如果您确保仅使用 javax.persistence 包中的注释,您将不依赖于一个具体的 JPA 实现(在本例中为 Hibernate),但理论上您可以交换 Hibernate对于 EclipseLink 或其他东西.

When designing your entities if you make sure that you use only annotations from the javax.persistence package you will not depend on one concrete JPA implementation (in this case Hibernate) but theoretically you could swap Hibernate for EclipseLink or something else.

这篇关于Spring数据是否需要休眠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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