title: JPA Native Query across multiple tables
body: <p>I have the following defined as a native query in a repository (dispenseRepository) :</p>
  <pre><code>@Query(
          value = &quot;SELECT p.*, c.*, s.*, d.* from patient p, consult c ,script s,dispense d &quot;
                  + &quot; where p.patient_id=c.patient_id &quot;
                  + &quot; and c.consult_id = d.consult_id &quot; 
                  + &quot; and c.fk_script_id =s.script_id&quot;
                  + &quot; and c.consult_id=?1 &quot;, 
          nativeQuery = true
  )
  List&lt;Dispense&gt; findInvoiceByConsultId(Long consultId);
  </code></pre>
  <p>The Rest Controller has :</p>
  <pre><code>  @RequestMapping(value = &quot;/api/invoice/{consultId}&quot;,method = {RequestMethod.GET}) 
      public List&lt;Dispense&gt; invoice(@PathVariable(value=&quot;consultId&quot;)Long consultId){
         return dispenseRepository.findInvoiceByConsultId(consultId);
      }
  </code></pre>
  <p>When I hit the api I only get dispense details:</p>
  <pre><code>[
  {
      &quot;dispenseId&quot;: 1,
      &quot;icd10&quot;: &quot;J.10&quot;,
      &quot;tariffCode&quot;: &quot;10010&quot;,
      &quot;dispenseItem&quot;: &quot;Lenses&quot;,
      &quot;price&quot;: 400.0
  },
  {
      &quot;dispenseId&quot;: 3,
      &quot;icd10&quot;: &quot;J.10&quot;,
      &quot;tariffCode&quot;: &quot;111000&quot;,
      &quot;dispenseItem&quot;: &quot;Other&quot;,
      &quot;price&quot;: 1500.0
  },
  {
      &quot;dispenseId&quot;: 4,
      &quot;icd10&quot;: &quot;K.100&quot;,
      &quot;tariffCode&quot;: &quot;10010&quot;,
      &quot;dispenseItem&quot;: &quot;Eye Test&quot;,
      &quot;price&quot;: 550.0
  }
  </code></pre>
  <p>]</p>
  <p>I'd like all the data as per query which will be used for Jasper report</p>
  <p><a href="https://i.stack.imgur.com/tkgYY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tkgYY.png" alt="ERD" /></a></p>
  <pre><code>patient-consult 1-M
  
  consult-script 1-1
  
  consult-dispense 1-M
  </code></pre>