diff --git a/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java b/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java index 9a9f6c12e..6477b482b 100644 --- a/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java +++ b/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2017 the original author or authors. + * Copyright 2008-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -599,16 +599,17 @@ public abstract class QueryUtils { /** * Returns whether the given {@code propertyPathModel} requires the creation of a join. This is the case if we find a - * non-optional association. + * optional association. * * @param propertyPathModel may be {@literal null}. - * @param forPluralAttribute - * @param forLeafProperty - * @return + * @param isPluralAttribute is the attribute of Collection type? + * @param isLeafProperty is this the final property navigated by a {@link PropertyPath}? + * @return wether an outer join is to be used for integrating this attribute in a query. */ - private static boolean requiresJoin(@Nullable Bindable propertyPathModel, boolean forPluralAttribute, boolean forLeafProperty) { + private static boolean requiresJoin(@Nullable Bindable propertyPathModel, boolean isPluralAttribute, + boolean isLeafProperty) { - if (propertyPathModel == null && forPluralAttribute) { + if (propertyPathModel == null && isPluralAttribute) { return true; } @@ -621,7 +622,8 @@ public abstract class QueryUtils { if (!ASSOCIATION_TYPES.containsKey(attribute.getPersistentAttributeType())) { return false; } - if (forLeafProperty && !attribute.isCollection()) { + + if (isLeafProperty && !attribute.isCollection()) { return false; } @@ -638,7 +640,7 @@ public abstract class QueryUtils { } Annotation annotation = AnnotationUtils.getAnnotation((AnnotatedElement) member, associationAnnotation); - return annotation == null ? true : (Boolean) AnnotationUtils.getValue(annotation, "optional"); + return annotation == null ? true : (boolean) AnnotationUtils.getValue(annotation, "optional"); } static Expression toExpressionRecursively(Path path, PropertyPath property) {