Spring 数据是否需要休眠 [英] Spring data required hibernate or not
问题描述
我对spring data的实现有一个疑问,对spring data有基本的了解.我了解 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屋!