JPA Typed Query Order By Clause for entities

I have a query system that is driven by front end users. The queries I generate at the back end are something like this

SELECT b FROM Book b ORDER BY b.author;

here author is a ManyToOne relation defined in Book. What happens is that author gets sorted by primary key. I would have wanted it to be sorted by name and see no way to tell JPA to do that.

Trying queries like

SELECT b FROM Book b ORDER BY b.author.name;

is futile since JPA complains that name is not in the selected list. So I am left with the issue of trying to find a way to override the default sorting behaviour for entities (Author in my example). Implementing Comparable, or adding the @OrderBy annotation to author is sadly of no help either.