[hibernate-issues] [Hibernate-JIRA] Assigned: (HSHARDS-44) Wrong sort algorithm for multiple sort fileds

Max Ross (JIRA) noreply at atlassian.com
Thu Aug 23 19:46:57 EDT 2007


     [ http://opensource.atlassian.com/projects/hibernate/browse/HSHARDS-44?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Max Ross reassigned HSHARDS-44:
-------------------------------

    Assignee: Maulik Shah  (was: Max Ross)

> Wrong sort algorithm for multiple sort fileds
> ---------------------------------------------
>
>                 Key: HSHARDS-44
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HSHARDS-44
>             Project: Hibernate Shards
>          Issue Type: Bug
>          Components: strategy
>    Affects Versions: 3.0.0.Beta2
>            Reporter: Aviad Lichtenstadt
>            Assignee: Maulik Shah
>         Attachments: SortMultipleByMultipleOrders.txt, SortMultipleByMultipleOrdersTest.txt
>
>
> Create a list of shuffled attributes when some of them are multiple such as:
> 1 aviad
> 1 mark
> 1 kobi
> 2 tom
> 2 john
> sort the list by both orders:
> ID and name.
> The list will be sorted only by the last field
> attached are junit path file to show the bug, and a fix (there is also a junit that shows the fix is wrong)
> watch out that in the Junit test patch the test is called "testFailMultipleOrderings" and it will path only because i am using there "assertNotSame"
> the fix is :
> The OrderExitOperation class should hod a list of properties to sort by
> and then the comparator should iterate over all the properties by their insert order
> the comparator algorithm:
> if the object are identical return 0;
> else compare the properties
>   if the properties comparison returns 0 go to next property
>   else return the comparison
> (the comparison should be multiplied by -1 in cases of descending order.)
>  I am also attaching a test to show this error, and its fix

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