Overview

In entire web applications, the DAO layer usually consists of a lot of boilerplate code that can be simplified.

Benefits of Simplification

  1. Decrease in the number of layers that we need to define and maintain
  2. Consistency of data access patterns and consistency of configuration

Spring Data JPA framework takes this simplification one step forward and makes it possible to remove the DAO implementations entirely. The interface of the DAO is now the only artifact that we need to explicitly define.

How It Works

For this, a DAO interface needs to extend the JPA specific Repository interface:


📚 Spring Data JPA Links (Bookmark them!)

  1. API Docs: https://docs.spring.io/spring-data/data-jpa/docs/current/api/
  2. Reference Docs: https://docs.spring.io/spring-data/jpa/docs/current-SNAPSHOT/reference/html/#reference

🏗️ Repository Interface Hierarchy

1. Root Interface

org.springframework.data.repository.Repository<T,ID>