SpringDataJpa Daquan

SpringDataJPA concept

  1. Spring ORM based on the Data JPA the Spring Framework, JPA specification package based on a JPA application framework, developers can use the code to enable access to the minimalist and operation of the database
  2. Spring Data JPA provides common functionality, including CRUD etc., and easy to expand, greatly improving the efficiency of development

SpringDataJPA Quick Start

1. Project Configuration

1.1 在pom.xml中添加相关依赖
1.2 在applicationContext.xml配置相应的配置
1.3 创建实体类和实体类对应的DAO接口
复制代码

2. Spring Data JPA DAO flow analysis

The underlying dynamic proxy used to complete the implementation class object interface, query based on the method name, more simple and convenient

3. Dao layer interface based approach

  • After the list of methods inherited JpaRepository
  • The list of methods inherited JpaSpecificationExecutor

Basically complete a simple crud and sorting, sorting, etc.

4.JPQL

  • query annotations

  • Specifications dynamic query

Reference Nuggets Gangster blog

Guess you like

Origin juejin.im/post/5cf9aa6e5188252fbc380857