HQL order by selected attribute

I've just started using HQL in 7.0.2 and I'm impressed by the support, especially the static analysis that a String parameter to a Spring method is HQL. I am seeing one little problem with it, though:

String hql = "select r.roleName from Application app inner join app.accounts acc inner join acc.roles r "
+ "where app.appName = :appName group by r.roleName order by r.roleName";
return (Collection) getHibernateTemplate().findByNamedParam( hql, "appName", appName); IDEA shows an error on the r.roleName following order by: "Orderable attribute of the entity being selected expected". But it doesn't really seem to be an error. It works as you'd expect, and there are similar examples from the Hibernate documentation (chapter 14, HQL): select count(payment), status.name from Payment as payment join payment.currentStatus as status where payment.status.name <> PaymentStatus.AWAITING_APPROVAL or payment.statusChanges[ maxIndex(payment.statusChanges) ].user <>]]> :currentUser
group by status.name, status.sortOrder
order by status.sortOrder

Am I doing something wrong, or is this just a bug in IDEA's error checking?

2 comments
Comment actions Permalink

Am I doing something wrong, or is this just a bug in IDEA's error checking?

It's a bug, please file a JIRA issue

0

Please sign in to leave a comment.