title: No results returned when using JPA Specifications in(Collection<?>) method
body: <p>I'm trying to implement the equivalent of this SQL query using Spring Data JPA Specifications:</p>
  <pre><code>SELECT * FROM product WHERE category_id IN (....)
  </code></pre>
  <p>The two entities involved in this query have a <code>OneToMany</code> and <code>ManyToOne</code> relationship:</p>
  <p>ProductEntity:</p>
  <pre><code>@Data
  @NoArgsConstructor
  @Entity
  @Table(name = &quot;PRODUCT&quot;)
  public class ProductEntity extends AbstractAuditableEntity {
  
      // skipped other properties for simplicity sake
  
      @ManyToOne
      private CategoryEntity categoryEntity;
  
  }
  </code></pre>
  <p>CategoryEntity:</p>
  <pre><code>@Entity
  @Table(name = &quot;PRODUCT_CATEGORY&quot;)
  @Data
  public class CategoryEntity extends AbstractBaseEntity {
  
      // skipped other properties for simplicity sake
  
      @OneToMany(mappedBy = &quot;categoryEntity&quot;)
      private List&lt;ProductEntity&gt; productEntities;
  
  }
  </code></pre>
  <p>My JPA Specifications query compiles and runs without any error, but doesn't return any result:
  Specification definition:</p>
  <pre><code>public static Specification&lt;ProductEntity&gt; inCategories(List&lt;Long&gt; categories) {
      return (root, query, builder) -&gt; {
          if (categories != null &amp;&amp; !categories.isEmpty()) {
              final Path&lt;CategoryEntity&gt; category = root.get(&quot;categoryEntity&quot;);
              return category.get(&quot;id&quot;).in(categories);
          } else {
              // always-true predicate, means that no filtering would be applied
              return builder.and();
          }
      };
  }
  </code></pre>
  <p>Client code:</p>
  <pre><code>    Page&lt;ProductEntity&gt; productEntityPage = productRepository.findAll(Specification
                      .where(ProductSpecifications.inCategories(filterCriteria.getCategories()))
              , pageRequest);
  </code></pre>
  <p>Why doesn't it work? I get results when querying the database using SQL statements, so there must be something wrong with either my JPA Specifications query or my entities mapping.</p>
  <p>What am I missing?</p>