title: JPA 2.0 Sub select in JPA criteria query
body: <p>How to write criteria query with subquery (use CriteriaBuilder construct method)?</p>
  
  <pre><code>  select t1.id,
         t1.name,
         (select count(t2.id) from table_name_2 t2 where t2.t1_id = t1.id) as   some_count
      from table_name t1
  </code></pre>
  
  <p>Thank in advance</p>