title: NHibernate: Could not resolve property: empAlias
body: <p>My purpose is to find <strong>Employee</strong> information in <strong>Project</strong> that have <strong>ProjectNumber</strong> > 2</p>
  
  <p>This is my query:</p>
  
  <pre><code>List&lt;EmployeeDAO&gt; empList = new List&lt;EmployeeDAO&gt;();
  using (ISession mySession = SessionFactory().OpenSession())
  {
      using (ITransaction myTransaction = mySession.BeginTransaction())
      {
          EmployeeDAO empDaoAlias = null;
          Employee empAlias = null;
          Group groupAlias = null;
          Project projectAlias = null;
          Rank rankAlias = null;
          EmployeeFunctionInProject efpAlias = null;
  
          empList = mySession.QueryOver&lt;Employee&gt;(() =&gt; empAlias)
              .JoinAlias(() =&gt; empAlias.Rank, () =&gt; rankAlias)
              .JoinAlias(() =&gt; empAlias, () =&gt; efpAlias.Employee)
              .Inner.JoinAlias(() =&gt; efpAlias.Project, () =&gt; projectAlias)
                  .Where(() =&gt; projectAlias.ProjectNumber &gt; 2)
              .Select(Projections.ProjectionList()
              .Add(Projections.Property(() =&gt; empAlias.Visa).WithAlias(() =&gt; empDaoAlias.Visa))
              .Add(Projections.Property(() =&gt; empAlias.FirstName).WithAlias(() =&gt; empDaoAlias.FirstName))
              .Add(Projections.Property(() =&gt; empAlias.LastName).WithAlias(() =&gt; empDaoAlias.LastName))
              .Add(Projections.Property(() =&gt; empAlias.FirstName).WithAlias(() =&gt; empDaoAlias.Project))
              .Add(Projections.Property(() =&gt; rankAlias.Name).WithAlias(() =&gt; empDaoAlias.Rank)))
              .TransformUsing(Transformers.AliasToBean&lt;EmployeeDAO&gt;())
              .List&lt;EmployeeDAO&gt;().ToList();
      }
  }
  return empList;
  </code></pre>
  
  <p>I got this error</p>
  
  <blockquote>
    <p>could not resolve property: empAlias of: MyWeb10.Models.Employee</p>
  </blockquote>
  
  <p>I doub that the problem occurs in line <code>.JoinAlias(() =&gt; empAlias, () =&gt; efpAlias.Employee)</code></p>
  
  <p>My Employee class</p>
  
  <pre><code>public class Employee {
      private int _id;
      private Rank _rank;
      private string _visa;
      private string _firstName;
      private string _lastName;
      private DateTime? _birthday;
      private string _university;
      private DateTime _rowversion;
      public Employee() {
          EmployeeFunctionInProject = new List&lt;EmployeeFunctionInProject&gt;();
          Group = new List&lt;Group&gt;();
      }
      public virtual int Id {
          get {
              return this._id;
          }
          set {
              this._id = value;
          }
      }
      public virtual Rank Rank {
          get {
              return this._rank;
          }
          set {
              this._rank = value;
          }
      }
      public virtual string Visa {
          get {
              return this._visa;
          }
          set {
              this._visa = value;
          }
      }
      public virtual string FirstName {
          get {
              return this._firstName;
          }
          set {
              this._firstName = value;
          }
      }
      public virtual string LastName {
          get {
              return this._lastName;
          }
          set {
              this._lastName = value;
          }
      }
      public virtual DateTime? Birthday {
          get {
              return this._birthday;
          }
          set {
              this._birthday = value;
          }
      }
      public virtual string University {
          get {
              return this._university;
          }
          set {
              this._university = value;
          }
      }
      public virtual DateTime Rowversion {
          get {
              return this._rowversion;
          }
          set {
              this._rowversion = value;
          }
      }
      public virtual IList&lt;EmployeeFunctionInProject&gt; EmployeeFunctionInProject { get; set; }
      public virtual IList&lt;Group&gt; Group { get; set; }
  }
  </code></pre>
  
  <p>My EmployeeFunctionInProject class</p>
  
  <pre><code>public class EmployeeFunctionInProject {
      private int _id;
      private Function _function;
      private Project _project;
      private Employee _employee;
      private DateTime _rowversion;
      public virtual int Id {
          get {
              return this._id;
          }
          set {
              this._id = value;
          }
      }
      public virtual Function Function {
          get {
              return this._function;
          }
          set {
              this._function = value;
          }
      }
      public virtual Project Project {
          get {
              return this._project;
          }
          set {
              this._project = value;
          }
      }
      public virtual Employee Employee {
          get {
              return this._employee;
          }
          set {
              this._employee = value;
          }
      }
      public virtual DateTime Rowversion {
          get {
              return this._rowversion;
          }
          set {
              this._rowversion = value;
          }
      }
  }
  </code></pre>
  
  <p>My Employee mapping</p>
  
  <pre><code>&lt;hibernate-mapping assembly="MyWeb10" namespace="MyWeb10.Models" xmlns="urn:nhibernate-mapping-2.2"&gt;
    &lt;class name="Employee" table="EMPLOYEE" lazy="true" &gt;
      &lt;id name="Id" column="ID"&gt;
        &lt;generator class="identity" /&gt;
      &lt;/id&gt;
      &lt;many-to-one name="Rank"&gt;
        &lt;column name="RANK" sql-type="int" not-null="true" /&gt;
      &lt;/many-to-one&gt;
      &lt;property name="Visa"&gt;
        &lt;column name="VISA" sql-type="varchar" not-null="true" unique="true" /&gt;
      &lt;/property&gt;
      &lt;property name="FirstName"&gt;
        &lt;column name="FIRST_NAME" sql-type="varchar" not-null="true" /&gt;
      &lt;/property&gt;
      &lt;property name="LastName"&gt;
        &lt;column name="LAST_NAME" sql-type="varchar" not-null="true" /&gt;
      &lt;/property&gt;
      &lt;property name="Birthday"&gt;
        &lt;column name="BIRTHDAY" sql-type="date" not-null="false" /&gt;
      &lt;/property&gt;
      &lt;property name="University"&gt;
        &lt;column name="UNIVERSITY" sql-type="varchar" not-null="true" /&gt;
      &lt;/property&gt;
      &lt;property name="Rowversion"&gt;
        &lt;column name="ROWVERSION" sql-type="timestamp" not-null="true" /&gt;
      &lt;/property&gt;
      &lt;bag name="EmployeeFunctionInProject" inverse="true"&gt;
        &lt;key column="EMPLOYEE" /&gt;
        &lt;one-to-many class="EmployeeFunctionInProject" /&gt;
      &lt;/bag&gt;
      &lt;bag name="Group" inverse="true"&gt;
        &lt;key column="LEADER" /&gt;
        &lt;one-to-many class="Group" /&gt;
      &lt;/bag&gt;
    &lt;/class&gt;
  &lt;/hibernate-mapping&gt;
  </code></pre>
  
  <p>My EmployeeFunctionInProject mapping</p>
  
  <pre><code>&lt;hibernate-mapping assembly="MyWeb10" namespace="MyWeb10.Models" xmlns="urn:nhibernate-mapping-2.2"&gt;
    &lt;class name="EmployeeFunctionInProject" table="EMPLOYEE_FUNCTION_IN_PROJECT" lazy="true" &gt;
      &lt;id name="Id" column="ID"&gt;
        &lt;generator class="identity" /&gt;
      &lt;/id&gt;
      &lt;many-to-one name="Function"&gt;
        &lt;column name="FUNCTION" sql-type="int" not-null="false" /&gt;
      &lt;/many-to-one&gt;
      &lt;many-to-one name="Project"&gt;
        &lt;column name="PROJECT" sql-type="int" not-null="false" /&gt;
      &lt;/many-to-one&gt;
      &lt;many-to-one name="Employee"&gt;
        &lt;column name="EMPLOYEE" sql-type="int" not-null="false" /&gt;
      &lt;/many-to-one&gt;
      &lt;property name="Rowversion"&gt;
        &lt;column name="ROWVERSION" sql-type="timestamp" not-null="true" /&gt;
      &lt;/property&gt;
    &lt;/class&gt;
  &lt;/hibernate-mapping&gt;
  </code></pre>