4 Working with Spring Data JPA

This chapter covers

  • Introducing Spring Data and its modules
  • Examining the main concepts of Spring Data JPA
  • Investigating the query builder mechanisms
  • Examining projections, and modifying and deleting queries
  • Examining Query by Example

Spring Data is an umbrella project containing many projects specific to various databases. These projects are developed in partnership with the companies creating the database technologies themselves. Spring Data’s goal is to provide an abstraction for data access while retaining the underlying specifics of the various data stores.

We’ll discuss the following general features provided by Spring Data:

  • Integration with Spring via JavaConfig and XML configuration
  • Repository and custom object-mapping abstractions
  • Integration with custom repository code
  • Dynamic query creation based on repository method names
  • Integration with other Spring projects, such as Spring Boot

4.1 Introducing Spring Data JPA

4.2 Starting a new Spring Data JPA project

4.3 First steps for configuring a Spring Data JPA project

4.4 Defining query methods with Spring Data JPA

4.5 Limiting query results, sorting, and paging

4.6 Streaming results

4.7 The @Query annotation

4.8 Projections

4.9 Modifying queries

sitemap