[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-1928) order-by mapping for collections overrides order by in Criteria
Gail Badner (JIRA)
noreply at atlassian.com
Tue Jan 24 17:47:10 EST 2012
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1928?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gail Badner updated HHH-1928:
-----------------------------
Affects Version/s: 3.6.9
> 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 ORM
> Issue Type: Bug
> Components: query-criteria
> Affects Versions: 3.2.0.cr3, 3.6.9
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list