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

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.

Leave a Comment