NHibernate MappingException could not compile mapping document

This is a fairly common error message which a programmer will receive during the NHibernate mapping process.


The inner exception was:

  • {“persistent class NAMESPACE.CLASSNAME, NAMESPACE not found”}
  • {“Could not compile the mapping document: NAMESPACE.CLASSNAME.hbm.xml”}

The root cause of this error was that the class (class.cs) existed in the NAMESPACE.Common namespace and in my mapping file (class.hbm.xml) within the class element I had entered NAMESPACE.COmmon. Therefore, a typo was the cause of this error. Changing the O to an o solved the problem.