Spring data required hibernate or not

2020-03-24 09:09发布

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

1条回答
Summer. ? 凉城
2楼-- · 2020-03-24 09:31

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.

查看更多
登录 后发表回答