[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4688) Make sure @OrderBy works for @ElementCollection

Scott Marlow (JIRA) noreply at atlassian.com
Tue Jan 5 14:47:29 EST 2010


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

Scott Marlow commented on HHH-4688:
-----------------------------------

Adding @OrderBy to org.hibernate.test.annotations.collectionelement.Boy didn't seem to work in my testing.  Should the following changes have worked?

	@ElementCollection
	@OrderBy  /* THIS IS THE ONLY CHANGE */
	@CollectionTable(
			name = "BoyFavoriteNumbers",
			joinColumns = @JoinColumn(name = "BoyId")
	)
	@Column(name = "favoriteNumber", nullable = false)
	@OrderColumn(name = "nbr_index")
	public int[] getFavoriteNumbers() {
		return favoriteNumbers;
	}

I didn't actually test for the result being ordered, I just visually verified that the sql is wrong and the returned values (after entity load) are wrong:

    select
        favoritenu0_.BoyId as BoyId0_,
        favoritenu0_.favoriteNumber as favorite2_0_,
        favoritenu0_.nbr_index as nbr3_0_ 
    from
        BoyFavoriteNumbers favoritenu0_ 
    where
        favoritenu0_.BoyId=?
Hibernate: 
    select
        favoritenu0_.BoyId as BoyId0_,
        favoritenu0_.favoriteNumber as favorite2_0_,
        favoritenu0_.nbr_index as nbr3_0_ 
    from
        BoyFavoriteNumbers favoritenu0_ 
    where
        favoritenu0_.BoyId=?



> Make sure @OrderBy works for @ElementCollection
> -----------------------------------------------
>
>                 Key: HHH-4688
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4688
>             Project: Hibernate Core
>          Issue Type: Sub-task
>          Components: annotations
>            Reporter: Emmanuel Bernard
>            Assignee: Scott Marlow
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list