[hibernate-issues] [Hibernate-JIRA] Issue Comment Edited: (HHH-1928) order-by mapping for collections overrides order by in Criteria

Artem Karpenko (JIRA) noreply at atlassian.com
Tue Jan 24 10:54:12 EST 2012


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1928?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45220#comment-45220 ] 

Artem Karpenko edited comment on HHH-1928 at 1/24/12 9:53 AM:
--------------------------------------------------------------

This bug still exists in 3.6.9.Final.
Is this going to be fixed in any nearest future?

      was (Author: artem.karpenko):
    This bug still exists in 3.6.9.Final.
  
> 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
>            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