-->
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.  [ 1 post ] 
Author Message
 Post subject: How is a Set returned in order?
PostPosted: Wed Sep 26, 2007 10:55 am 
Newbie

Joined: Thu Jul 12, 2007 12:16 pm
Posts: 3
Is there anyone that can explain to me how a set is sorted? For example in my hbm.xml file I map a one to many relationship as below:

Code:
<set name="managerNames" inverse="true"
   order-by="EffectiveDate desc">
   <key column="ManagerId" />
   <one-to-many entity-name="ManagerName" />
</set>


As you can see I request this Set to be returned sorted by effectiveDate so when I perform myBean.getManagerNames() I get all the manager names returned in descending order. Being that Sets and HashSets are unordered how is Hibernate able to return the manager names in the proper order? When I debug I don't see any reference to a TreeSet or a LinkedHashSet, and the only thing I can determine by looking at the documentation is that a PersistentSet (used by SOAP) is also not ordered and uses an underlying HashSet.

Can anyone explain this to me?


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

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.