Skip to content

Commit dc854df

Browse files
SWQXDBAmp911de
authored andcommitted
Fix handling of null predicate in Specification.not().
When toPredicate() returns null, Specification.not() now returns builder.disjunction() instead of builder.not(null). This change ensures proper handling of null predicates in negated specifications. Closes #3849 Original pull request: #3856 Signed-off-by: SWQXDBA <[email protected]>
1 parent 5ebfdb6 commit dc854df

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/Specification.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static <T> Specification<T> not(Specification<T> spec) {
156156
return (root, query, builder) -> {
157157

158158
Predicate predicate = spec.toPredicate(root, query, builder);
159-
return predicate != null ? builder.not(predicate) : null;
159+
return predicate != null ? builder.not(predicate) : builder.disjunction();
160160
};
161161
}
162162

0 commit comments

Comments
 (0)