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?