diff --git a/spring-graphql/src/main/java/org/springframework/graphql/data/QuerydslDataFetcher.java b/spring-graphql/src/main/java/org/springframework/graphql/data/QuerydslDataFetcher.java index cb85d09bc..60a72df27 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/data/QuerydslDataFetcher.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/data/QuerydslDataFetcher.java @@ -21,6 +21,7 @@ import java.util.Map; import java.util.function.Function; +import com.querydsl.core.BooleanBuilder; import com.querydsl.core.types.EntityPath; import com.querydsl.core.types.Predicate; import graphql.schema.DataFetcher; @@ -153,7 +154,16 @@ protected Predicate buildPredicate(DataFetchingEnvironment environment) { parameters.put(entry.getKey(), Collections.singletonList(entry.getValue())); } - return BUILDER.getPredicate(this.domainType, (MultiValueMap) parameters, bindings); + Predicate predicate = BUILDER.getPredicate(this.domainType, (MultiValueMap) parameters, bindings); + + // Temporary workaround for this fix in Spring Data: + // https://github.com/spring-projects/spring-data-commons/issues/2396 + + if (predicate == null) { + predicate = new BooleanBuilder(); + } + + return predicate; } private static Function createProjection(Class projectionType) {