Reputation: 5035
I was having an intermittent NHibernate issue that turned out to be caused by having an hbm mapping to a class as well as a Fluent NHibernate mapping. This was unintentional and once discovered I dropped the hbm mapping and all works well now. My question is this: are there situation where having multiple mappings on a class/table would be valid and/or useful? If not is there a way of detecting redundant mappings in a unit test so it could be guaranteed not to happen?
Thanks, Matthew
Upvotes: 0
Views: 382
Reputation: 52753
No, having multiple mappings for the same class is never valid. I can't think of a case where it would be useful either.
A unit test for this is easy: just check that DuplicateMappingException
isn't thrown when building the SessionFactory.
Upvotes: 1