title: NHibernate : Query by example on primary key produces "WHERE (1=1)"
body: <p>I have an entity Customer</p>
  
  <pre><code>public class Customer
  {
      public virtual int ID { get; set; }
      public virtual string Firstname { get; set; }
      public virtual string Lastname { get; set; }
  }
  </code></pre>
  
  <p>and my DAL method is :</p>
  
  <pre><code>    public IList&lt;Customer&gt; GetCustomers(Customer example)
      {
          var customers = default(IList&lt;Customer&gt;);
  
          using (var sessiong = GetSession())
          {
              customers = sessiong.CreateCriteria(typeof(Customer))
                  .Add(Example.Create(example))
                  .List&lt;Customer&gt;();
          }
  
          return customers;
      }
  </code></pre>
  
  <p>but the problem is that when I call my method like this</p>
  
  <pre><code>    var exemple = new Customer() { ID = 2 };
      var customers = provider.GetCustomers(exemple);
  </code></pre>
  
  <p>I have a collection of all my customers in the database because NHibernate generates the following SQL query</p>
  
  <pre><code>NHibernate: SELECT this_.CustomerId as CustomerId0_0_, this_.Firstname as Firstname0_0_, this_.Lastname as Lastname0_0_ FROM Customers this_ WHERE (1=1)
  </code></pre>
  
  <p>NHibernate supports QBE on primary key ?
  What am I doing wrong ? </p>
  
  <p>P.S. I've forgotten to mention the version of NHibernate that I'm using. It's 2.0.1.GA.</p>