I found a bug, or at least a serious problem:
When the index column in a many-to-many relation with a sorted list is named 'Order', then NHibernate crashes when loading collections from this relation.
The reason is that in my mapping file I have to put in [Order] because Order is a SQL keyword. Upon loading the collection NHibernate uses the string [Order] to lookup the field index in a SqlDataReader, which fails miserably with a IndexOutOfBoundsException.
With the build 1.0.2 (downloaded today) the exception happens in file Driver\NHybridDataReader.cs in line 362, GetOrdinal(name). And yes, I'm very proud that I debugged this problem myself :-)
Now, it'd be questionable if I should use column names that are keywords. However, nothing in NHibernate is preventing me from doing that. So I'll leave it to the community to determine whether this is a bug or I have a crappy DB design ;-)
Take care, Christoph
|