title: Hibernate Criteria: adding additional restriction to Restrictions.isEmpty
body: <p>I have created a Hibernate (3.5) Criteria query:</p>
  
  <pre><code>Criteria criteria = db.getSession().createCriteria(Vendor.class);
  criteria.add(Restrictions.isEmpty("models"));
  </code></pre>
  
  <p>When executed with Criteria.list, Hibernate produces the following SQL (simplified for sake of readability):</p>
  
  <pre><code>SELECT this_.*
  FROM   VENDOR this_
         left outer join MODEL models1_
           ON this_.id = models1_.VENDOR_ID
  WHERE  NOT EXISTS (SELECT 1
                     FROM   MODEL
                     WHERE  this_.id = VENDOR_ID)
  </code></pre>
  
  <p>What I'd like to do is add a restriction within the "not exists" part so that the SQL query would look like this
  
  <code><pre>
  SELECT this_.* FROM VENDOR this_
  left outer join MODEL models1_
           ON this_.id = models1_.VENDOR_ID
  WHERE
  NOT EXISTS (SELECT 1
                               FROM   MODEL
                               WHERE  this_.id = VENDOR_ID <strong>AND DEPRECATED = 0</strong> )
  </pre></code></p>
  
  <p>Is that possible using the Hibernate Criteria API and if yes, how? Or is there some other possibility to achieve the same result (but still using Criteria API)?</p>