SpringDataJPA (ORM object-relational mapping framework)

  1. Relations JPA, SpringDataJPA, hibernate in

A) is a specification JPA only (we usually corresponds to said interface), but is an implementation of JPA hibernate, and is further encapsulated to SpringDataJPA of JPA

  1. Operational data

a) When a batch query, the definition of a List, list which incoming queries to the number and so on.

b) plus page when ordering, first get to sort objects, and then get paged object, sort object page spread inside the object, then the object passed to the query page statement

  1. Spring集成SpringDataJPA

a) guide the packet (SpringDataJPA must import two core package jpa-spec, spring-data-jpa)

b) the configuration file ApplicationContext.xml

c) complete repository functions

                     i. Repository of custom interfaces to inherit JpaRepository interface contains a number of methods of operation of the database,

                   . ii            the Spring the Data JPA seven Repository of interfaces:

Repository(org.springframework.data.repository.Repository)
CrudRepository(org.springframework.data.repository.CrudRepository)
PagingAndSortingRepository(org.springframework.data.repository.PagingAndSortingRepository)
JpaRepository (org.springframework.data.jpa.repository.JpaRepository)
QueryByExampleExecutor(org.springframework.data.repository.query.QueryByExampleExecutor)
JpaSpecificationExecutor (org.springframework.data.jpa.repository.JpaSpecificationExecutor)
QueryDslPredicateExecutor (org.springframework.data.querydsl.QueryDslPredicateExecutor)
 
Repository achieve two major categories:
SimpleJpaRepository(org.springframework.data.jpa.repository.support.SimpleJpaRepository)
QueryDslJpaRepository(org.springframework.data.jpa.repository.support.QueryDslJpaRepository)

                  iii. @Query notes queries

  1. The @Query above method can be annotated hit repository

                  iv.            JpaSpecification[Office1] Executor[Office2] 

  1. This method of all interfaces to pass a Specification [Office3]  objects
  2. Extraction Query query conditions

a) BaseQuery extraction

                                                        i. and extracted Specification for a method of sorting [Office4]  is an abstract method

                                                      ii. DomainQuery Fu write inherited BaseQuery Specification [Office5]  method, add the query conditions.

Guess you like

Origin www.cnblogs.com/8888-lhb/p/11291886.html