@@ -33,7 +33,7 @@ public Predicate getFilterExpression(CriteriaBuilder cb, Root<T> root, String ex
3333
3434 var path = getPath (root , expression );
3535
36- if (removeDiacritics == null ) {
36+ if (removeDiacritics == null || removeDiacritics . isBlank () ) {
3737 return switch (filterType ) {
3838 case EQUALS -> cb .equal (cb .upper (path ), typedValue .toUpperCase ());
3939 case IS_NULL -> cb .or (cb .isNull (path ), cb .equal (cb .trim (path ), "" ));
@@ -50,16 +50,18 @@ public Predicate getFilterExpression(CriteriaBuilder cb, Root<T> root, String ex
5050 }
5151 else {
5252 return switch (filterType ) {
53- case EQUALS -> cb .equal (cb .upper (path ), typedValue .toUpperCase ());
53+ case EQUALS -> cb .equal (cb .function (removeDiacritics , String .class , cb .upper (path )),
54+ cb .function (removeDiacritics , String .class , cb .literal (typedValue .toUpperCase ())));
5455 case IS_NULL -> cb .or (cb .isNull (path ), cb .equal (cb .trim (path ), "" ));
55- case NOT_EQUALS -> cb .notEqual (cb .upper (path ), typedValue .toUpperCase ());
56+ case NOT_EQUALS -> cb .notEqual (cb .function (removeDiacritics , String .class , cb .upper (path )),
57+ cb .function (removeDiacritics , String .class , cb .literal (typedValue .toUpperCase ())));
5658 case IS_NOT_NULL -> cb .and (cb .isNotNull (path ), cb .notEqual (cb .trim (path ), "" ));
57- case CONTAINS -> cb .like (cb .upper (path ),
58- '%' + typedValue .toUpperCase () + '%' );
59- case STARTS_WITH -> cb .like (cb .upper (path ),
60- typedValue .toUpperCase () + '%' );
61- case ENDS_WIDTH -> cb .like (cb .upper (path ),
62- '%' + typedValue .toUpperCase ());
59+ case CONTAINS -> cb .like (cb .function ( removeDiacritics , String . class , cb . upper (path ) ),
60+ cb . function ( removeDiacritics , String . class , cb . literal ( '%' + typedValue .toUpperCase () + '%' )) );
61+ case STARTS_WITH -> cb .like (cb .function ( removeDiacritics , String . class , cb . upper (path ) ),
62+ cb . function ( removeDiacritics , String . class , cb . literal ( typedValue .toUpperCase () + '%' )) );
63+ case ENDS_WIDTH -> cb .like (cb .function ( removeDiacritics , String . class , cb . upper (path ) ),
64+ cb . function ( removeDiacritics , String . class , cb . literal ( '%' + typedValue .toUpperCase ()) ));
6365 default -> throw new IllegalArgumentException ();
6466 };
6567 }
0 commit comments