[hibernate-issues] [Hibernate-JIRA] Created: (ANN-448) @OrderBy does not work with an association table when Set is used for collection

Mike Wilson (JIRA) noreply at atlassian.com
Thu Oct 5 04:55:24 EDT 2006


@OrderBy does not work with an association table when Set is used for collection
--------------------------------------------------------------------------------

         Key: ANN-448
         URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-448
     Project: Hibernate Annotations
        Type: Bug

    Versions: 3.2.0.cr2    
 Environment: Hibernate 3.2CR4, Oracle 10
    Reporter: Mike Wilson
 Attachments: patch.txt

We are using Set for our mapped collections, and not Collection like in the unit tests for annotations. We can see that the items are inserted in the Set according to the order governed by @OrderBy, but apparently Hibernate is not using an order-preserving Set like f ex LinkedHashSet. 

We were under the impression that Hibernate would support ordered Sets by using a suitable (ordered) Set subclass when an @OrderBy is specified and this is confirmed by Emmanuel on http://forum.hibernate.org/viewtopic.php?p=2324711.

I supply a patch file that adds a new test case to the annotations "ManyToMany" test:

GroupWithSet.java: 
- property "permissions" as Set instead of Collection

ManyToManyTest.java: 
- new method "testAssociationTableAndOrderByWithSet()" with:
  . using GroupWithSet
  . added an extra permission + check order of all three perms to avoid the 50% chance of random order being correct 

(And I have tested by running against CVS HEAD version)

Best regards
Mike Wilson

-- 
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