I am trying to have a user selection paginated with a search and a order by a custom function (levenshtein function).
The order by function allow me to display in first position the users with the firstname starting by the search characters, and then after, the user that have the search characters at any place into their firstname.
What I tryed :
- Use
@Formula
but we can not use variable into it to add the search parameter to the formula (exemple : "levenshtein('firstname', search-input)") - Use of
query.orderBy
into a Specification but I get the errorPSQLException: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
- Use of a class
OrderBySqlFormula
for hibernate but I dont find where I can pass the object to the Specification - Use of
JpaSort.unsafe
but I get error[ERROR] No property ... found for type 'MyEntity'
Did anyone have any idea to solve this issue ?
Thanks in advance, BrandonFL