JPA criteria query, order on class
问题 Is there a way with JPA criteria queries to order on class ? Imagine the following domain objects: abstract class Hobby { ... } class Coding extends Hobby { ... } class Gaming extends Hobby { ... } Using regular QL I was able to do from Hobby h order by h.class But when I apply the same logic on a criteria query, the runtime exception "unknown attribute" occurs. CriteriaQuery<Hobby> criteriaQuery = builder.createQuery(Hobby.class); Root<Hobby> hobbyRoot = criteriaQuery.from(Hobby.class);