Похожие презентации:
Spring data. Familiar and consistent programming model for data access
1.
Spring data2.
Spring dataFamiliar and consistent programming model for data access.
3.
Features- Powerful repositories.
- Dynamic query derivation from method names.
- Easy spring integration.
4.
Modules- Spring data commons.
- Spring data jpa.
- Spring data mongodb.
- Spring data redis.
- Spring data cassandra.
- Spring data gemfire.
- Spring data rest.
5.
Dependency<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
6.
Repository interfaces-Repository
-CrudRepository
-PagingAndSortingRepository
-JpaRepository
7.
Example@Repository
public interface EmployeeRepository extends CrudRepository<Employee, Long> {
Employee findByFirstName(String firstName);
List<Employee> findByLastName(String lastName);
}
8.
Method naming conventionfind…By, read…By, query…By, count…By, and get…By:
findDistinctPeopleByLastnameOrFirstname
findByLastnameAndFirstnameAllIgnoreCase
findByLastnameOrderByFirstnameDesc
queryFirst10ByLastname
findTop3ByLastname
9.
Async repositoriesFuture<User> findByUsername(String username);
CompletableFuture<User> findByUsername(String username);
10.
Auditing@CreatedDate