title: spring data jpa filter children in @OneToMany
body: <p><br>
  I have a <strong>EmployeeTest</strong> entity which is parent and <strong>FunGroupInfo</strong> entity which is child. both these two entities are <strong>mapped by employeeId</strong>. I need a way to filter out the child entities which matches the search condition, so that the result will contain only parent and child(which meets requirement). </p>
  
  <p>EmployeeTest class:</p>
  
  <pre><code>@Entity(name = "EmployeeTbl")
  public class EmployeeTest{
   @Id
   @Column(name = "emp_id")
   private String employeeId;
  
   @OneToMany(mappedBy= "employeeId", fetch =FetchType.Eager)
   private Set&lt;FunGroupInfo&gt; funGroupInfo;
  }
  </code></pre>
  
  <p>FunGroupInfo class:</p>
  
  <pre><code>@Entity(name = "FunGroupTbl")
  public class FunGroupInfo{
   @Id
   @Column(name = "group_id")
   private String groupId;
  
   @Column(name = "emp_id")
   private String employeeId;
  
   @Column(name = "type_id")
   private String typeId;
  
   @Column(name = "active")
   private String activeFlag;
  
  }
  </code></pre>
  
  <p>EmpRepository Interface:</p>
  
  <pre><code>@Repository
  public interface EmpRepository extends JpaRepository&lt;EmployeeTest, String&gt;{
  List&lt;EmployeeTest&gt; findByFunGroupInfoTypeId(String typeId)
  }
  
  //inside by test method
  
  @Autowired 
  private EmpRepository  empRepository;
  
  List&lt;EmployeeTest&gt; empList = empRepository.findByFunGroupInfoTypeId("2");
  </code></pre>
  
  <p>Above line returns me List with FunGroupInfo where typeId are in 1, 2, 3, 4, 5 but i need to get the only the matching FunGroupInfo with typeId 2 info</p>
  
  <p>Result which i get now <img src="https://i.stack.imgur.com/4VvLa.png" alt="Result which i get now"> but i actually need only the highlighted one along with parent</p>