3

I have read this line in spring docs "The query builder mechanism built into the Spring Data repository infrastructure", can anyone please tell which class exactly does this query building part in spring?

1 Answers1

1

You should look at org.springframework.data.jpa.repository.query.JpaQueryCreator and also at org.springframework.data.jpa.repository.query.PartTreeQuery. The former does the actual construction of the query. The latter holds all the pieces together: The parsed PartTree containing the structure of the method name, arguments, the processing of results and so on.

Jens Schauder
  • 77,657
  • 34
  • 181
  • 348
  • Follow-up question: On startup the `QueryExecutorMethodInterceptor` creates a `Map` of queries by "inspecting" the Spring Data repositories. Is it possible to access/list this kind of queries programmatically? Analogous to `NamedQuery`s like in https://stackoverflow.com/questions/12614906/list-of-all-namedqueries-in-jpa. Motivation is to create a convenient way to search for the usage of certain fields... – bgraves Jan 21 '22 at 11:30