title: JPA CriteriaQuery: getCount + condition
body: <p>I try to get all the count of Articles (Article.class) which are not analyzed (analyzed == false).
  Sadly the following code returns absolutely wrong numbers.
  Would anybody know why?</p>
  
  <pre><code>CriteriaBuilder cb = entityManager.getCriteriaBuilder();
  CriteriaQuery&lt;Long&gt; query = cb.createQuery(Long.class);
  query.select(cb.count(query.from(Article.class)));
  Root&lt;Article&gt; articles = query.from(Article.class);
  Predicate condition = cb.isFalse(articles.get(Article_.analyzed));
  query.where(condition);
  TypedQuery&lt;Long&gt; unanalyzedArticlesAmount = entityManager.createQuery(query);
  return unanalyzedArticlesAmount.getSingleResult();
  </code></pre>