Spring Boot 2.0 Projects
上QQ阅读APP看书,第一时间看更新

Understanding Spring Data JPA

The Spring Data JPA project is an abstraction over JPA which vastly simplifies the process of object/relation mapping, querying, and so on. The following are some of the features of Spring Data JPA:

  • Reduces/eliminates unnecessary boilerplate code
  • Ease of building repositories with Spring and JPA
  • Support for type-and value-safe JPA queries
  • Support for database-independent auditing
  • Support for database-independent pagination, custom query execution, and so on  

Spring Data JPA eases Create, Retrieve, Update, Delete (CRUD) operations by allowing the JpaRespository interface, which extends from CrudRepository. This hides the complexities of plain JPA implementations, which need to be implemented and tested by developers. Using Spring Data JPA could reduce the development time dramatically because of this. 

In upcoming chapters, JpaRepository with default methods and custom methods will be used extensively to implement business logic and demonstrate how to write Spring Data JPA repositories and test them. The following sections will discuss how to use a domain model designed using a class diagram as a base to implement Spring Data JPA-based entities and repositories.