title: Mapping in configuration file when using Nhibernate's mapping by code
body: <p>I want to use mapping by code so I have a class <b>Employee</b> (<code>namespace NHibernateTests.Classes</code>) and a class <b>EmployeeMappings</b> (<code>namespace NHibernateTests.Mappings</code>)</p>
  
  <p>My whole nhibernate configuration is set in an xml file <code>hibernate.cfg.xml</code> which currently goes like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"&gt;
    &lt;session-factory&gt;
      &lt;property name="connection.provider"&gt;NHibernate.Connection.DriverConnectionProvider&lt;/property&gt;
      &lt;property name="connection.driver_class"&gt;NHibernate.Driver.OracleClientDriver&lt;/property&gt;
      &lt;property name="connection.connection_string"&gt;User Id=NHIBERNATE;Password=NHIBERNATE;Data Source=XE&lt;/property&gt;
      &lt;property name="show_sql"&gt;false&lt;/property&gt;
      &lt;property name="dialect"&gt;NHibernate.Dialect.Oracle10gDialect&lt;/property&gt;
  
      &lt;mapping assembly="NHibernateTests"/&gt;
    &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>Which gives me the runtime error : <b>No persister for: NHibernateTests.Classes.Employee
  </b></p>
  
  <p>I tried (and error) some setting for <code>mapping</code> element but with no luck. I read how to set ressource for hbm.xml elements but couldn't find an answer for <code>by code</code> mapping.</p>
  
  <pre><code>namespace NHibernateTests.Classes
  {
      public class Employee
      {
          public virtual Address Address { get; set; }
          public virtual string FirstName { get; set; }
          public virtual int Id { get; set; }
      }
  }
  </code></pre>
  
  <p><br/></p>
  
  <pre><code>namespace NHibernateTests.Mappings
  {
      public class EmployeeMappings : ClassMapping&lt;Employee&gt;
      {
          public EmployeeMappings()
          {
              this.Id(e =&gt; e.Id, mapper =&gt;
              {
                  mapper.Generator(Generators.HighLow);
              });
          }
      }
  }
  </code></pre>