So until we upgrade to Hibernate 6+, the only option is to duplicate the named queries (i.e. have a different named query for each sort variant). I tried to search for a way to reuse named query fragments to reduce duplication, but I couldn't find any good result. So it's doable, but for now it implies adding some code (query) duplication.
This message was sent by Atlassian Jira (v9.3.0#930000-sha1:287aeb6)
If image attachments aren't displayed, see this article.