Spring + hibernate versus Spring Data JPA: Are they different?

前端 未结 4 921
既然无缘
既然无缘 2021-01-31 02:10

Although not novice, I am trying to learn spring framework (again!) in order to be sure that I really understand this. I have got fair idea on core Spring (DI). Now, I am focusi

4条回答
  •  梦如初夏
    2021-01-31 02:50

    Spring-data-jpa, as you're saying, offers more that just the classical Spring-JPA integration. With JPA/Hibernate integration, you get mainly

    • declarative transaction management using JPA/Hibernate transactions
    • exception translation
    • the JPA EntityManager or the Hibernate SessionFactory as injectable beans

    With Spring-data-jpa, you get all that, plus (among other things)

    • interface-only repositories, using method names to infer queries automatically
    • @Query annotation to define the query that an interface method should return
    • automatic handling of Pageable queries
    • base classes for standard crud repositories

    This is just a tiny introduction. For more help, read the documentation.

提交回复
热议问题