If I interpret the JPA spec correctly (section 4.9), an "orderby_item" of the order-by clause always references an element declared in the select clause, so I don't think it'd be ambigious in the context of JPQL.