From: Georg S. <ge...@sc...> - 2002-03-05 14:40:18
|
ORDER BY does not work with the selection of property of value type, e.g.: SELECT many.one FROM many IN CLASS test.Many ORDER BY many.one.value (many has a many-to-one mapping to one) Hibernate generates the following SQL: SELECT DISTINCT one2.one_key, one1.value FROM one one2, one one1, many many WHERE 1=1 and many.one_key = one2.one_key ORDER BY one1.value without a join of one1.one_key and one2.one_key or many.one_key. After looking through the source I found a disabled call in cirrus.hibernate.query.OrderByParser, line 30. With the following change: @@ -30,7 +30,7 @@ public class OrderByParser implements Pa - //q.appendWhereToken( pathExpressionParser.getJoin() ); + q.appendWhereToken( pathExpressionParser.getWhereJoin() ); Hibernate generates the following (correct) SQL: SELECT DISTINCT one2.one_key, one1.value FROM one one2, one one1, many many WHERE 1=1 and many.one_key = one1.one_key and many.one_key = one2.one_key ORDER BY one1.value I run the tests with this change and all went ok. Why is the the call disabled? If nothing else brakes I will change this in cvs and add a test for ORDER BY. Bye, Georg |