title: nhibernate, could not resolve property
body: <p>I have a problem with NHibenate. When I run queryover, I get an error "could not resolve property: User.Name of: MegaOnlineChat.Core.Entities.Message".What am I doing wrong?</p>
  
  <p>Entity objects</p>
  
  <pre><code>public class EntityObject&lt;TId&gt;
      {
          public virtual Int32 Id { get; set; }
      }
  public class User:EntityObject&lt;Int32&gt;
      {
          public virtual String Name { get; set; }
          public virtual String Password { get; set; }
          public virtual Boolean Admin { get; set; }
          public virtual IList&lt;Message&gt; Messages { get; set; }
      }
  public class Message:EntityObject&lt;Int32&gt;
      {
          public virtual String Text { get; set; }
          public virtual User User { get; set; }
          public virtual DateTime Date{ get; set; }
      }
  </code></pre>
  
  <p>Mapping</p>
  
  <pre><code>public class UserMapping:ClassMap&lt;User&gt;
  {
      public UserMapping()
      {
          Table("Users");
          Id(m =&gt; m.Id).GeneratedBy.Native();
          Map(m =&gt; m.Name).Unique().Not.Nullable();
          Map(m =&gt; m.Admin).Not.Nullable();
          Map(m =&gt; m.Password).Not.Nullable();
  
          HasMany(m =&gt; m.Messages).KeyColumn("User_id");
      }
  }
  public class MessageMapping:ClassMap&lt;Message&gt;
  {
      public MessageMapping()
      {
          Table("Messages");
  
          Id(m =&gt; m.Id).GeneratedBy.Native();
  
          Map(m =&gt; m.Text).Not.Nullable();
          Map(m =&gt; m.Date).Not.Nullable();
  
          References(m =&gt; m.User, "User_id").Not.Nullable();
      }
  }
  </code></pre>
  
  <p>QueryOver</p>
  
  <pre><code>NHibernateSession.QueryOver&lt;Message&gt;().Where(x =&gt; x.User.Name == name).List&lt;Message&gt;().Last();
  </code></pre>