Skip to content

Commit b2d9b77

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 <983110853@qq.com>
1 parent 934fdd4 commit b2d9b77

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

+1-1
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)