title: Inner join 3 tables with NHibernate Queryover
body: <p>I need to join 3 tables  with NHibernate Queryover
  , but I cant get it to work. Any suggestions?</p>
  
  <p>I used this code
  <a href="http://www.d80.co.uk/post/2011/02/20/Linq-to-NHibernate-Tutorial.aspx" rel="nofollow">http://www.d80.co.uk/post/2011/02/20/Linq-to-NHibernate-Tutorial.aspx</a></p>
  
  <p>NHibernate code</p>
  
  <pre><code>namespace SimpleNHibernateClient.ConsoleApplication
  {
  class Program
  {
      static void Main(string[] args)
      {
          ReadALL();
          Console.ReadKey();
      }
  
      private static Make ReadALL()
      {
          using (var session = NHibernateHelper.OpenSession())
          {
              var makeQuery = session.QueryOver&lt;Make&gt;()
              .Where(_ =&gt; _.Name == _.Name)
              .List()
  
              foreach (var m in makeQuery)
              {
                  Console.WriteLine("Name: " + m.Name);
                  Console.WriteLine("Description: " + m.Description); //Dont Work
              }
              return null;
          }
      }
  
  }
  
  public class Car
  {
      public virtual int Id { get; set; }
      public virtual string Title { get; set; }
      public virtual string Description { get; set; }
      public virtual Make Make { get; set; }
      public virtual Model Model { get; set; }
  }
  
  public class Make
  {
      public virtual int Id { get; set; }
      public virtual string Name { get; set; }
      public virtual IList&lt;Model&gt; Models { get; set; }
  }
  
  public class Model
  {
      public virtual int Id { get; set; }
      public virtual string Name { get; set; }
      public virtual Make Make { get; set; }
  }
   }
  
  
   namespace SimpleNHibernateClient.ConsoleApplication
   {
  public class CarMap : ClassMap&lt;Car&gt;
  {
      public CarMap()
      {
          Id(x =&gt; x.Id);
          Map(x =&gt; x.Title);
          Map(x =&gt; x.Description);
          References(x =&gt; x.Make).Column("MakeId");
          References(x =&gt; x.Model).Column("ModelId");
          Table("Car");
      }
  }
  
  public class MakeMap : ClassMap&lt;Make&gt;
  {
      public MakeMap()
      {
          Id(x =&gt; x.Id);
          Map(x =&gt; x.Name);
          HasMany(x =&gt; x.Models)
              .KeyColumn("MakeId");
          Table("Make");
      }
  }
  
  public class ModelMap : ClassMap&lt;Model&gt;
  {
      public ModelMap()
      {
          Id(x =&gt; x.Id);
          Map(x =&gt; x.Name);
          References(x =&gt; x.Make)
              .Column("MakeId");
          Table("Model");
      }
  }
  
  
  
  
  namespace SimpleNHibernateClient.ConsoleApplication
  {
      public class NHibernateHelper
      {
          private static ISessionFactory _sessionFactory;
  
          private static ISessionFactory SessionFactory
          {
              get
              {
                  if (_sessionFactory == null)
                      InitializeSessionFactory();
  
                  return _sessionFactory;
              }
          }
  
          private static void InitializeSessionFactory()
          {
              _sessionFactory = Fluently.Configure()
                  .Database(MsSqlConfiguration.MsSql2008
                                .ConnectionString(
                                    @"Server=localhost;Database=SimpleNHibernate;Trusted_Connection=True;")
  
                  )
                  .Mappings(m =&gt;
                            m.FluentMappings
                                .AddFromAssemblyOf&lt;Car&gt;())
                  .BuildSessionFactory();
          }
  
          public static ISession OpenSession()
          {
              return SessionFactory.OpenSession();
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>SQL Query</p>
  
  <pre><code>SELECT * FROM Make INNER JOIN Model ON Make.Id = Model.MakeId 
  INNER JOIN Car ON Make.Id = Car.MakeId AND Model.Id = Car.ModelId
  </code></pre>