NHibernate Mapping Concerns

I encountered two errors in my code related to mapping.

First, there was incompatiblitity between IList (which was how I defined my collection properties in the Resume object, like Education History) and NHibernate’s Set mapping. (It turns out that Set derives from a non-native library called Iesi.Collections. I tried referencing Iesi.Collections in my code but it seems that it couldn’t find it in my NHibernate.dll.) It was resolved by changing the <set> tag in my map to a <bag> tag.

The second was some loading problem when my code tried to call the collection values. I learned that the bi-directional association which I set into my mapping doesn’t work for indexed collections like IList. I then took out the many-to-one tag, and it worked.

With these major mapping issues ironed out, I can now proceed with completing the DAO (data access object) implementation of my resume schema, and then move on to creating the UI forms for them.

Post a Comment