A list is a data structure where element are associated with a numerical index in the list which governs the ordering of elements. NHibernate will persist this ordering using an index-column. A list in NHibernate will not be rearranged just be being persisted to the DB and then read back.
Perhaps you can use either a SortedList as per http://nhforge.org/doc/nh/en/index.html#collections-sorted with the UpdateDate as index column. /Oskar 2012/12/19 Tim Robinson <tim.j.robin...@gmail.com>: > Hi, > > In my data model I have a simple situation with document which has many > versions. I want the versions to be retrieved in order (most recent first) > so I have mapped the association like this > > HasMany(x => x.Versions) > .AsList() > .OrderBy("UpdateDate DESC") > .KeyColumn("DocumentId") > .Inverse() > .Cascade.AllDeleteOrphan(); > > The problem is that when nhibernate generates the SQL, it tries to retrieve > a nonexistent column called 'index' from the database. If I take out the > AsList() specifier it seems to work OK and returns them in the correct order > but I'm not sure whether this is just luck. can anyone explain what AsList > is actually supposed to do? > > I've read about indexed and ordered collections in the jboss hibernate > documentation but it's not really clear how it all translates into fnh > > --- Tim > > -- > You received this message because you are subscribed to the Google Groups > "Fluent NHibernate" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/fluent-nhibernate/-/fpPtoQCMjBsJ. > To post to this group, send email to fluent-nhibernate@googlegroups.com. > To unsubscribe from this group, send email to > fluent-nhibernate+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/fluent-nhibernate?hl=en. -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibernate@googlegroups.com. To unsubscribe from this group, send email to fluent-nhibernate+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.