title: Mapping inheritance in NHibernate 3.3
body: <p>I have the inheritance described below :</p>
  
  <pre><code>public abstract class BaseEntity&lt;TId&gt; {....}
  
  public abstract class ModelEntity : BaseEntity&lt;Int32&gt;{....}
  
  public abstract class AuditableEntity : ModelEntity,IAuditable{....}
  
  public class ApplicationUser : AuditableEntity{....}
  
  public class SuperUser : ApplicationUser
  </code></pre>
  
  <p>I am using NHibernate 3.3 and I want to Create the mappings for that inheritance</p>
  
  <pre><code>public abstract class ModelEntityMap&lt;TEntity&gt; : ClassMapping&lt;TEntity&gt;
          where TEntity : ModelEntity
  {...}
  
  public class AuditableEntityMap&lt;TEntity&gt; : ModelEntityMap&lt;TEntity&gt; where TEntity : AuditableEntity
  { ...}
  
  public class ApplicationUserMap : AuditableEntityMap&lt;ApplicationUser&gt;
  {...}
  
  public class SuperUserMap : JoinedSubclassMapping&lt;SuperUser&gt;{...}
  </code></pre>
  
  <p>When the application starts and trys to set up the database it raises the following Exception :
  Ambiguous mapping for SuperUser More than one root entities was found BaseEntity / ApplicationUser</p>
  
  <p>Possible solutions
  -Merge the mapping of root Entity in the one is representing the real root in the hierarchy
  -Inject a IModelInspector with a logic to discover the real root-entity.</p>
  
  <p>I was using Fluent nhibernate with the same inheritance and worked fine with SuperUserMap defined as 
  public class SuperUserMap : SubClassMap {...}</p>
  
  <p>I am new to Nhibernate mapping by code and quite confused !!!</p>