Is it possible to sort the Set collection using hibernate, in sql without using SortedSet interface, without using @OrderBy annotation – just using criteria’s addOrder.
I’ve tried it and it adds order by clause but the set isn’t sorted.
I use hibernate 3.4.
NHibernate Sets don’t have “order” even though the set mapping supports an order-by. See Ayende’s explanation:
You can append the order by clause to the underlying SQL, but that order is lost when NHibernate builds the set. Using an “ordered” set or other collection type (bag or list) will work, of course.