-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: What does natural sort sort on?
PostPosted: Thu Dec 16, 2004 8:43 am 
Newbie

Joined: Wed Sep 01, 2004 5:31 am
Posts: 18
Hi all,

I haved evaluated Hibernate as part of my master thesis and just have a question regarding natural sorting of collections. Consider the following (made up) scenario:

<set name="pets"
table="person_pet"
sort="natural">
<key column="person_id"/>
<composite-element class="Pet"/>
</set>

In the book Hibernate in action its described that natural sort will use the compareTo() method of java.lang.String to sort the collection in memory. But i cant seem to find information on which elements are compared to eachother. Are all the elements of Pet, in this case, used? Or is it sorted by the key somehow. I cant find any information on this and would appreciate if anyone could clarify it for me.

Cheers / A.Kikr

PS. This forum is awsome! Cool that the Hibernate team takes the time to answer so many questions. DS.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 16, 2004 8:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
sort works just like calling java.util.List.sort()


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 16, 2004 8:53 am 
Newbie

Joined: Wed Sep 01, 2004 5:31 am
Posts: 18
Damn you ppl are fast :-)

Thanks for clarifying!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 16, 2004 9:02 am 
Newbie

Joined: Wed Sep 01, 2004 5:31 am
Posts: 18
Hm... nope im still confused. java.util.List has no sort() method and nore does any of the other java collection types that I've looked at either. Am i being really daft here?

Cheers / A.kikr


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 16, 2004 9:13 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
okay, java.util.Collections.sort() :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 16, 2004 10:36 am 
Newbie

Joined: Wed Sep 01, 2004 5:31 am
Posts: 18
Sweet, thanks mate. Silly of me not to check that.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.