]
Kai Moritz commented on HHH-1928:
---------------------------------
This bug is still open in 3.2.6.ga!
Is it resolved in 3.5?
order-by mapping for collections overrides order by in Criteria
---------------------------------------------------------------
Key: HHH-1928
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1928
Project: Hibernate Core
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.2.0.cr3
Reporter: Nguyen Hau Giang
Attachments: testcase.zip
relating to:
HHH-594(order-by mapping for collections overrides order by in HQL)
HHH-484(order-by not applied to collections fetched by OuterJoinLoader)
Mapping(pseudo code):
<class name="Master">
<id name="id" />
<set name="details" order-by="DISP_NO">
<one-to-many class="Detail" />
</set>
</class>
<class name="Detail">
<id name="id" />
<property name="dispNo" />
<many-to-one name="master" class="Master" />
</class>
Same problem as in HHH-594, but instead of querying by HQL, when query by Criteria using
join-fetch:
session.createCriteria(Master.class)//
.setFetchMode("details", FetchMode.JOIN)//
.addOrder(Order.asc("id"))//
.list();
order-by mapping for collection overrides order by in Criteria:
from
Master this_
left outer join
Detail details2_
on this_.id=details2_.ID
order by
details2_.DISP_NO,
this_.id asc
or when creating left-join alias:
session.createCriteria(Master.class)//
.createAlias("details", "D", Criteria.LEFT_JOIN)//
.addOrder(Order.asc("id"))//
.list();
generated SQL:
from
Master this_
left outer join
Detail d1_
on this_.id=d1_.ID
order by
d1_.DISP_NO,
this_.id asc
The order property specified in Criteria should be prior to order of collection mapping.
I think this problem should be fixed as with HQL in HHH-594.
For details, please see attached test case.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: