I’ve roles like lead > collaborator > participant > viewer. If I use
orderBy(role) then getting order as collaborator > lead > participant > viewer
If I do DESC order then getting reverse.
I tried specifying order in SQL and it’s working as expected getting lead > collaborator > participant > viewer
ORDER BY ROLE = 'viewer', ROLE = 'participant', ROLE = 'collaborator', ROLE = 'lead';
The same I want to achieve in Java Spring Boot. How can I?
3
Answers
I've achieved this by specifying the order
You have to create this method in your service :
If your roles are static (seldom if ever changes) then you can accomplish this by creating a
enum
(Create Emun and Alter Type enum ) for them. (see demo)I am not sure how to accomplish this in your obscurification manager (Spring Boot) so you will have to translate it or use raw sql.