title: Spring JPA Specification to filter one to many relation with child entity
body: <p>I have an entity InwardInventory as below</p>
  
  <pre><code>@Entity
  @Table(name = "inward_inventory")
  public class InwardInventory extends ReusableFields
  {
  
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      Long in_inventoryId;
  
      @ManyToMany(fetch=FetchType.EAGER,cascade = CascadeType.ALL)
      @JoinTable(name = "inventory_entry", joinColumns = {
              @JoinColumn(name = "in_inventoryId", referencedColumnName = "in_inventoryId") }, inverseJoinColumns = {
                      @JoinColumn(name = "entryId", referencedColumnName = "entryId") })
      Set&lt;InwardOutwardList&gt; inwardOutwardList = new HashSet&lt;&gt;();;
  
  //many other fields
  }
  </code></pre>
  
  <p>Entity InwardOutwardList have fields like productId and quantity.</p>
  
  <pre><code>@Entity
  @Table(name = "inward_outward_entries")
  @Audited
  @Where(clause = ReusableFields.SOFT_DELETED_CLAUSE)
  public class InwardOutwardList extends ReusableFields
  {
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      Long entryid;
  
      @ManyToOne(fetch=FetchType.LAZY,cascade = CascadeType.ALL)
      @JoinColumn(name="productId",nullable=false)
      @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
      Product product;
      Float quantity;
  //other fields and getter setters
  }
  </code></pre>
  
  <p>I want to write a specification to filter inwardinventory based product id. Example - If I pass productId as 100, it should return all inwardinventory list which has entry for product 100. Can someone help me how to write specification where we have to query list or set of entities.</p>