What is the difference between query-methods find…By, read…By, query…By, and get…By in spring data?
I don't know how about other subprojects, but for Spring Data JPA (1.10.2) these methods will work as aliases. Each method invocation will generate identical criteria query (and identical SQL query).
Internally there is no distinction between these prefixes. It's used only for query pattern matching:
private static final String QUERY_PATTERN = "find|read|get|query|stream";
https://github.com/spring-projects/spring-data-commons/blob/8bc022ebd7097b921ae1ef6c87f0ae9fc05bba5f/src/main/java/org/springframework/data/repository/query/parser/PartTree.java#L54
The same approach is used for remove...By
vs delete...By
methods:
private static final String DELETE_PATTERN = "delete|remove";
I think this will help you to understand..
The difference between the two interfaces lies in the semantic of their methods. The CRUD repository “finds” something whereas the JPA repository “gets” something. While “find” might lead to no result at all, “get” will always return something – otherwise the JPA repository throws an exception.
source: https://tuhrig.de/find-vs-get/
You can see this post also. https://softwareengineering.stackexchange.com/questions/182113/how-and-why-to-decide-between-naming-methods-with-get-and-find-prefixes