Skip to content

Commit 08d49a8

Browse files
mp911derstoyanchev
authored andcommitted
Refine Querydsl integration documentation
Update repository example to implement Repository. Mention customizing and projection capabilities. See gh-78
1 parent bac7461 commit 08d49a8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

spring-graphql-docs/src/docs/asciidoc/index.adoc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,15 @@ default it is marked as `INTERNAL_ERROR`.
300300
Spring GraphQL supports use of http://www.querydsl.com/[Querydsl] to fetch data through
301301
the Spring Data
302302
https://docs.spring.io/spring-data/commons/docs/current/reference/html/#core.extensions[Querydsl extension].
303+
Querydsl provides a flexible yet typesafe approach to express query predicates by
304+
generating a meta-model using annotation processors.
303305

304306
For example, declare a repository as `QuerydslPredicateExecutor`:
305307

306308
[source,java,indent=0,subs="verbatim,quotes"]
307309
----
308-
public interface AccountRepository extends QuerydslPredicateExecutor<Account> {
310+
public interface AccountRepository extends Repository<Account, Long>,
311+
QuerydslPredicateExecutor<Account> {
309312
}
310313
----
311314

@@ -330,6 +333,14 @@ If the repository is `ReactiveQuerydslPredicateExecutor`, the builder returns
330333
`DataFetcher<Mono<Account>>` or `DataFetcher<Flux<Account>>`. Spring Data supports this
331334
variant for MongoDB.
332335

336+
The Querydsl integration allows customizing the request parameters binding onto a
337+
`Predicate` by accepting a `QuerydslBinderCustomizer`. Request parameters are bound
338+
by default as "is equal to" for each available property in the request.
339+
340+
`QuerydslDataFetcher` supports
341+
https://docs.spring.io/spring-data/commons/docs/current/reference/html/#projections[interface and DTO projections]
342+
to transform query results before returning these for further GraphQL processing.
343+
333344
The {repository}/samples/webmvc-http[webmvc-http] sample in the Spring GraphQL repository
334345
uses Querydsl to fetch `artifactRepositories`.
335346

0 commit comments

Comments
 (0)