Issue
I am using the Sort feature provided in spring boot to sort my results. Consider an Entity "Employee" with properties like "id", "name" & "expertise".
"expertise" property can have values like "Java", "Python", "Admin", "Pascal" etc. I need to sort Employees based on expertise such that it is ordered as follows -
- Python
- Java
- Pascal
- Admin
Is there any way within the spring boot Sort feature to achieve such sorting?
Solution
Found a working solution. For each expertise, I added a column of type integer with name as "order_number". Instead of using the expertise name, I started using the order_number column for sorting and it produced the desired results.
Answered By - Tapan