File tree 2 files changed +18
-1
lines changed
main/antlr4/org/springframework/data/jpa/repository/query
test/java/org/springframework/data/jpa/repository/query
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -533,8 +533,9 @@ expressionOrPredicate
533
533
;
534
534
535
535
// https://docs.jboss.org/hibernate/orm/6.1/userguide/html_single/Hibernate_User_Guide.html#hql-relational-comparisons
536
+ // NOTE: The TIP shows that "!=" is also supported. Hibernate's source code shows that "^=" is another NOT_EQUALS option as well.
536
537
relationalExpression
537
- : expression op=(' =' | ' >' | ' >=' | ' <' | ' <=' | ' <>' ) expression
538
+ : expression op=(' =' | ' >' | ' >=' | ' <' | ' <=' | ' <>' | ' != ' | ' ^= ' ) expression
538
539
;
539
540
540
541
// https://docs.jboss.org/hibernate/orm/6.1/userguide/html_single/Hibernate_User_Guide.html#hql-between-predicate
Original file line number Diff line number Diff line change @@ -564,6 +564,22 @@ WHERE TYPE(e) <> Exempt
564
564
""" );
565
565
}
566
566
567
+ @ Test // GH-2970
568
+ void alternateNotEqualsShouldAlsoWork () {
569
+
570
+ assertQuery ("""
571
+ SELECT TYPE(e)
572
+ FROM Employee e
573
+ WHERE TYPE(e) != Exempt
574
+ """ );
575
+
576
+ assertQuery ("""
577
+ SELECT TYPE(e)
578
+ FROM Employee e
579
+ WHERE TYPE(e) ^= Exempt
580
+ """ );
581
+ }
582
+
567
583
@ Test
568
584
void theRest5 () {
569
585
You can’t perform that action at this time.
0 commit comments