← All tutorials

GoCareerGo Tutorials

Spring Boot Tutorial

Auto-configuration, REST APIs, JPA, AOP, caching, microservices and Spring Cloud.

Derived Query Methods

Spring Data JPA parses your repository method NAME to build the query — no SQL or JPQL required for common cases.

List<User> findByLastName(String lastName);
List<User> findByAgeGreaterThanEqual(int age);
List<User> findByLastNameAndFirstName(String last, String first);
Optional<User> findByEmailIgnoreCase(String email);
List<User> findTop5ByOrderByCreatedAtDesc();
Tip

Know the keyword vocabulary: And, Or, Between, LessThan, GreaterThanEqual, Like, OrderBy, Top/First.