DB2 SQL Error: SQLCODE=-214, SQLSTATE=42822 using Hibernate
Issue
-
An HQL typed query uses
DISTINCTandORDER BYwhere theORDER BYcolumns 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 BYclauseDB2 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 of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
