title: NHibernate query-over with restriction on a referenced entity
body: <p>I am using Nhibernate with SQL server 2008.</p>
  
  <p>I am trying to execute the following code:</p>
  
  <pre><code>        var localization = session.QueryOver&lt;T&gt;()
              .Where(idFilter).AndRestrictionOn(x =&gt; x.Language.IETFTag).IsLike(tag + "%").SingleOrDefault();
  </code></pre>
  
  <p>However, I get an exception on that line that says nhibernate cannot resolve property Language.IETFTag (or something to that effect).</p>
  
  <p>I have tried using JoinQueryOver() but then it complains that I have multiple correlations in the FROM clause or something weird like that. It simply feels like I am doing something very wrong. How can I do what I want?</p>
  
  <p>I have the following mapping:</p>
  
  <pre><code>internal class LocalizationMapping : ClassMap&lt;Localization&gt;
  {
      public LocalizationMapping()
      {
          UseUnionSubclassForInheritanceMapping();
          Id(x =&gt; x.Id).GeneratedBy.HiLo("HiLo", "NextHi", "1000");
          References(x =&gt; x.Language);
      }
  }
  
  internal class LanguageMapping : ClassMap&lt;Language&gt;
  {
      public LanguageMapping()
      {
          Id(x =&gt; x.Id);
          Map(x =&gt; x.DefaultName);
          Map(x =&gt; x.IETFTag);
      }
  }
  
  internal class ArticleLocalizationMapping : SubclassMap&lt;ArticleLocalization&gt;
  {
      public ArticleLocalizationMapping()
      {
          Map(x =&gt; x.Name);
          Map(x =&gt; x.Description);
          References(x =&gt; x.Article);
      }
  }
  </code></pre>