Showing
1 changed file
with
5 additions
and
1 deletions
@@ -426,11 +426,15 @@ public class EntityKeyMapping { | @@ -426,11 +426,15 @@ public class EntityKeyMapping { | ||
426 | 426 | ||
427 | private String buildComplexPredicateQuery(QueryContext ctx, String alias, EntityKey key, | 427 | private String buildComplexPredicateQuery(QueryContext ctx, String alias, EntityKey key, |
428 | ComplexFilterPredicate predicate, EntityFilterType filterType) { | 428 | ComplexFilterPredicate predicate, EntityFilterType filterType) { |
429 | - return predicate.getPredicates().stream() | 429 | + String result = predicate.getPredicates().stream() |
430 | .map(keyFilterPredicate -> this.buildPredicateQuery(ctx, alias, key, keyFilterPredicate, filterType)) | 430 | .map(keyFilterPredicate -> this.buildPredicateQuery(ctx, alias, key, keyFilterPredicate, filterType)) |
431 | .filter(Objects::nonNull).collect(Collectors.joining( | 431 | .filter(Objects::nonNull).collect(Collectors.joining( |
432 | " " + predicate.getOperation().name() + " " | 432 | " " + predicate.getOperation().name() + " " |
433 | )); | 433 | )); |
434 | + if (!result.trim().isEmpty()) { | ||
435 | + result = "( " + result + " )"; | ||
436 | + } | ||
437 | + return result; | ||
434 | } | 438 | } |
435 | 439 | ||
436 | private String buildSimplePredicateQuery(QueryContext ctx, String alias, EntityKey key, | 440 | private String buildSimplePredicateQuery(QueryContext ctx, String alias, EntityKey key, |