I know spring data jpa can execute sql by two ways.One is execute sql which is included by @Query, the other is parse method name and generate sql. I clone the source code of spring data jpa from github and want to find how spring data generate sql according to method name.But I can't find the class which is related to parse method name.So,could you tell me something about how spring data jpa works about parsing method name?Thanks
Asked
Active
Viewed 1,854 times
6
-
Possible duplicate of [How are Spring Data repositories actually implemented?](https://stackoverflow.com/questions/38509882/how-are-spring-data-repositories-actually-implemented) – Jens Schauder Oct 13 '18 at 05:43
1 Answers
7
Its a multi-step process:
- Spring Data JPA generates a proxy class for the repository interface.
- The proxy generates a
PartTree
instance for each repository method using thePartTreeJpaQuery
class. ThePartTree
class is part of the Spring Data Commons module, which is a dependency for the store-specific Spring Data modules (like the Spring Data JPA module). - The
PartTree
is then passed to aJpaQueryCreator
to generate a JPACriteriaQuery
instance. - The
CriteriaQuery
instance is passed to the underlying JPA provider (Hibernate, OpenJPA, EclipseLink, etc.) which then generates SQL to be executed.

manish
- 19,695
- 5
- 67
- 91
-
2please let me know if there is any documentation available for this. – Rahul Singh Aug 22 '16 at 20:38