File tree 3 files changed +21
-5
lines changed
antlr4/org/springframework/data/jpa/repository/query
java/org/springframework/data/jpa/repository/query
test/java/org/springframework/data/jpa/repository/query
3 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -362,7 +362,7 @@ like_expression
362
362
;
363
363
364
364
null_comparison_expression
365
- : (single_valued_path_expression | input_parameter | nullif_expression) IS (NOT )? NULL
365
+ : (single_valued_path_expression | input_parameter | nullif_expression) (( IS (NOT )?) | (op=( EQUAL | NOT_EQUAL ))) NULL
366
366
;
367
367
368
368
empty_collection_comparison_expression
Original file line number Diff line number Diff line change @@ -1315,10 +1315,13 @@ public List<JpaQueryParsingToken> visitNull_comparison_expression(EqlParser.Null
1315
1315
tokens .addAll (visit (ctx .nullif_expression ()));
1316
1316
}
1317
1317
1318
- tokens .add (new JpaQueryParsingToken (ctx .IS ()));
1319
-
1320
- if (ctx .NOT () != null ) {
1321
- tokens .add (new JpaQueryParsingToken (ctx .NOT ()));
1318
+ if (ctx .op != null ) {
1319
+ tokens .add (new JpaQueryParsingToken (ctx .op .getText ()));
1320
+ } else {
1321
+ tokens .add (new JpaQueryParsingToken (ctx .IS ()));
1322
+ if (ctx .NOT () != null ) {
1323
+ tokens .add (new JpaQueryParsingToken (ctx .NOT ()));
1324
+ }
1322
1325
}
1323
1326
tokens .add (new JpaQueryParsingToken (ctx .NULL ()));
1324
1327
Original file line number Diff line number Diff line change @@ -401,4 +401,17 @@ void coalesceFunctions() {
401
401
assertQuery ("SELECT b FROM Bundle b WHERE coalesce(b.deleted, false) AND b.latestImport = true" );
402
402
assertQuery ("SELECT b FROM Bundle b WHERE NOT coalesce(b.deleted, false) AND b.latestImport = true" );
403
403
}
404
+
405
+ @ Test // GH-3314
406
+ void isNullAndIsNotNull () {
407
+
408
+ assertQuery ("SELECT e FROM Employee e WHERE (e.active = null OR e.active = true)" );
409
+ assertQuery ("SELECT e FROM Employee e WHERE (e.active = NULL OR e.active = true)" );
410
+ assertQuery ("SELECT e FROM Employee e WHERE (e.active IS null OR e.active = true)" );
411
+ assertQuery ("SELECT e FROM Employee e WHERE (e.active IS NULL OR e.active = true)" );
412
+ assertQuery ("SELECT e FROM Employee e WHERE (e.active != null OR e.active = true)" );
413
+ assertQuery ("SELECT e FROM Employee e WHERE (e.active != NULL OR e.active = true)" );
414
+ assertQuery ("SELECT e FROM Employee e WHERE (e.active IS NOT null OR e.active = true)" );
415
+ assertQuery ("SELECT e FROM Employee e WHERE (e.active IS NOT NULL OR e.active = true)" );
416
+ }
404
417
}
You can’t perform that action at this time.
0 commit comments