title: JPA 2.0 Criteria and grouping of Predicates
body: <p>I encounter problem with Hibernate EntityManager 3.5.3-Final when it comes to composite predicates.</p>
  
  <p>Example (not actual code snippet, but the idea should be clear):</p>
  
  <pre><code>CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
  Predicate predicate1 = criteriaBuilder.conjunction();
  Predicate predicate2 = criteriaBuilder.conjunction();
  // These are Boolean expression with common Root
  predicate1.getExpressions().add(expression1);
  predicate1.getExpressions().add(expression2);
  predicate2.getExpressions().add(expression3);
  predicate2.getExpressions().add(expression4);
  //...
  query.where(criteriaBuilder.or(predicate1, predicate2));
  </code></pre>
  
  <p>Now, I would expect something like:</p>
  
  <pre><code>SELECT ... FROM ... WHERE (expression1 AND expression2) OR (expression3 AND expression4)
  </code></pre>
  
  <p>However I end up with:</p>
  
  <pre><code>SELECT ... FROM ... WHERE expression1 AND expression2 OR expression3 AND expression4
  </code></pre>
  
  <p>Am I doing something awfully wrong or is it Hibernate issue?</p>