title: How to join tables using Query DSL
body: <p>I am using queryDsl for complex search queries in my application. I am new to querydsl. I have started with the below code to fetch few rows from one single table(TableA).
  But I have to find list of person(Count) with the same id in some other table(TableB)</p>
  
  <pre><code>public static Predicate find(final Long pId)
      QPerson qPerson = QPerson.person;
      Predicate predicate; 
      BooleanBuilder booleanBuilder = new BooleanBuilder();
      if (pId != null) {
          booleanBuilder.or(qPerson.person_no.eq(pId));
      } 
      if (name != null &amp;&amp; !name.isEmpty()) {
          booleanBuilder.or(qPerson.expiry_dt.eq(name));
      }
      predicate = booleanBuilder.getValue();   
      return predicate;
      }
  </code></pre>
  
  <p>TableA:</p>
  
  <pre><code>pId         name
  
  1001      sampleNameA
  1002      sampleNameB
  1003      sampleNameC
  </code></pre>
  
  <p>TableB:</p>
  
  <pre><code>pId        name       interests
  
  1001     sampleNameA    music   
  1001     sampleNameA    dance
  1001     sampleNameA    coding
  1003     sampleNameC    music   
  1002     sampleNameB    dance
  1002     sampleNameB    coding
  </code></pre>
  
  <p>I need to get output like this with below query</p>
  
  <p>select  cnt cnt, tableA.* from master_person_table tableA,(select count(*) cnt from tableB WHERE pId = '1002') cnt
  WHERE pId = '1002'</p>
  
  <p>OUTPUT: </p>
  
  <pre><code>  count  pId        name       
      2    1002   sampleNameB    
  </code></pre>
  
  <p>I need to display the no of rows (for id=1002) in my HTML.</p>
  
  <p>Can anyone please help me in finding the count of the pId to be fetched from tableB</p>
  
  <p>Thanks in advance</p>