title: How to discover Implicit multiple root
body: <p>here's my show case code:</p>
  
  <pre><code>CriteriaBuilder cb = em.getCriteriaBuilder();
  CriteriaQuery&lt;Tuple&gt; q = cb.createTupleQuery();
  Root&lt;AA&gt; aa = q.from(AA.class);
  
  q.multiselect(aa.get("id").alias("id"),
  articolo.get("a").alias("a"),
  articolo.get("b").alias("b"),
  articolo.get("c").get("t").alias("c"),
  articolo.get("d").alias("d"));
  
  System.out.println("RootCount: "+q.getRoots().size());
  
  Query query = em.createQuery(q);
  List&lt;Tuple&gt; list = query.getResultList();
  </code></pre>
  
  <p>Where AA is a mapped Table and c is a CC type item (in wich CC is another mapped table):</p>
  
  <p>well, i'm not allowed to insert an image, so: <a href="http://img6.imageshack.us/img6/3383/catturass.png" rel="nofollow">Tables Schema</a></p>
  
  <p>c is a foreignkey referencing the table CC</p>
  
  <p>So, the above code will print "RootCount: 1" (only one root) but the resulting query would be something like this:</p>
  
  <pre><code>select aa.id, aa.a, aa.b, cc.t, aa.d from AA aa, CC cc where aa.c=cc.id
  </code></pre>
  
  <p>so...two roots, but the q.getRoots() report only the one i explicitly have defined.</p>
  
  <p>How can i get the real roots?</p>