title: JPA Criteria API join query One To Many with condition
body: <p>I have 2 Table</p>
  <ol>
  <li>Enterprise</li>
  </ol>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>ID</th>
  <th>Name</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>Alex</td>
  </tr>
  </tbody>
  </table>
  </div>
  <ol start="2">
  <li>Product</li>
  </ol>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>ID</th>
  <th>Name</th>
  <th>Status</th>
  <th>EnterpriseId</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>7</td>
  <td>Iphone12</td>
  <td>ACTIVE</td>
  <td>1</td>
  </tr>
  <tr>
  <td>8</td>
  <td>Iphone11</td>
  <td>ACTIVE</td>
  <td>1</td>
  </tr>
  <tr>
  <td>6</td>
  <td>Iphone13</td>
  <td>DISABLE</td>
  <td>1</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>The relationship is one to many (one Enterprise having many Product). I want to get an <code>Enterprise</code> with all their <code>Product</code> with a condition is <code>Status</code> of this <code>Product</code> is <code>ACTIVE</code></p>
  <p>How can I get the result in json is</p>
  <pre><code>  {
  &quot;id&quot;: &quot;1&quot;,
  &quot;name&quot;: &quot;Alex&quot;,
  &quot;products&quot;: [
    {
      &quot;id&quot;: &quot;7&quot;,
      &quot;name&quot;: &quot;Iphone12&quot;,      
    },
    {
      &quot;id&quot;: &quot;8&quot;,
      &quot;name&quot;: &quot;Iphone11&quot;,
    }
   ]
  }
  
  
  
  
  
  
    
  </code></pre>