DB2 SQL Error: SQLCODE=-214, SQLSTATE=42822 using Hibernate
Issue
-
An HQL typed query uses
DISTINCT
andORDER BY
where theORDER BY
columns include a column that cannot be mapped to the HQL return typeSELECT DISTINCT employee FROM Employee employee, Task task ... ORDER BY employee.name, task.id
-
The database driver raises an exception indicating the un-mapped column is illegal in the
ORDER BY
clauseDB2 SQL Error: SQLCODE=-214, SQLSTATE=42822, SQLERRMC=id;ORDER BY;2, DRIVER=4.15.134
Environment
- Red Hat JBoss Enterprise Application Platform (EAP) 7
- Hibernate 5
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.