The naive attempt query would look like this:
Query query = em.createQuery("from org.domain.Resource r where r._parent = ? order by ?");
This does not work as the parameters should be data and not column names or syntax like ASC or DESC.
What kind of workarounds you have figured out for this dynamic ordering? Concatenating the ordering string to the query string is the obvious one but are there any better ones?