Spring数据需要休眠或不休眠 [英] Spring data required hibernate or not

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

问题描述

对春季资料的实施我有一个疑问,对春季资料有基本的了解。
我理解JPA和Hibernate,它是如何工作的。 Hibernate为JPA提供了实现。
我的问题,我们可以单独使用Spring的数据来保存mysql中的数据,或者我们需要一些提供程序,如hibernate或toplink等,以便用于中型应用程序。

解决方案

  Spring Data JPA 
|
JPA
|
Hibernate

您需要Hibernate作为JPA实现,但从您的角度来看,您应该只能看到Spring数据JPA。



在设计实体时,如果确保只使用 javax.persistence 中的注释,包你不会依赖于一个具体的JPA实现(在这里是Hibernate),但理论上你可以将Hibernate换成EclipseLink或其他东西。

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

解决方案

The structure is as follows:

Spring Data JPA
       |
      JPA
       |
   Hibernate

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

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天全站免登陆