Custom sort of string column with spring jpa using pageable

26 Views Asked by At

Using Pageable and Spring JPA , I want to do a custom sort of a String column by Hexadecimal order, but I didn 't find a way to integrate the algorithm of sorting string to hexa and edit the pageable before doing find query:

//edit pageable to handle the sort of hexa field here
myRepository.findAll(pageable)

the algo that i want to integrate with the pageable to sort the string as Hexa is :

    public static int compareHexValues(String hex1, String hex2) {
        BigInteger int1 = new BigInteger(hex1, 16);
        BigInteger int2 = new BigInteger(hex2, 16);
        return int1.compareTo(int2);
    }
0

There are 0 best solutions below