Hi,
there seems to be a problem with hibernate 3.2.6 and derby 10.3.2.1. The derby guys fixed a bug in this release:
DERBY-2351
The following query executed fine on previous releases, but now fails with the new derby version:
Code:
Hibernate: select distinct user0_.ID as ID10_, user0_.EMAIL as EMAIL10_, user0_.FIRSTNAME as FIRSTNAME10_, user0_.LASTNAME as LASTNAME10_, user0_.ROLE as ROLE10_, user0_.USERNAME as USERNAME10_ from XY.XUSER user0_ where user0_.ROLE=? order by user0_.LASTNAME
2008-04-07 15:56:25,937 WARN [http-8080-2] org.hibernate.util.JDBCExceptionReporter: SQL Error: -1, SQLState: 42879
2008-04-07 15:56:25,937 ERROR [http-8080-2] org.hibernate.util.JDBCExceptionReporter: The ORDER BY clause may not contain column 'LASTNAME', since the query specifies DISTINCT and that column does not appear in the query result.
If I change the order by clause to user0_.LASTNAME10_ it works. Could anybody please confirm that this is now a bug related to hibernate? My knowledge about this is limited, so I wanted to ask first instead of fileing a bug report.
Regards,
Simon