title: How can I write spring data query with IN statement?
body: <p>I need to get Entity1's by entity2's ids </p>
  
  <p>There is params for query -  List numbers - ids of entity2
  .
  And two entities with @OneToMany bound</p>
  
  <pre><code>@Entity
  class Entity1 {
  private Integer id;
  
  private Entity2 entity2;
  
  ---------
  @OneToMany(cascade = ALL, fetch =FetchType.EAGER)
  @Column
  public Entity2 getEntity2(){
  return entity2;
  
  }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>@Entity
  public class Entity2{
  
  private Integer id;
  
  @ManyToOne(FetchType.LAZY)
  private Entity1 entity1;
  }
  </code></pre>
  
  <p>i have working code</p>
  
  <pre><code>@Repository
  public interface Entity1Repository extends JpaRepository&lt;Entity1, Integer&gt; {
  
  @Query("SELECT c" +
              " FROM  Entity1 c" +
              " inner JOIN  c.entity2 a" +
              "  WHERE  a.id IN(?1)")
      Set&lt;Entity1&gt; findByEntity2Ids(List&lt;Integer&gt; pEntity2_Ids);
  }
  </code></pre>
  
  <p>i want beautify query by using Spring Data</p>
  
  <p>and write something like</p>
  
  <pre><code>Set&lt;Entity1&gt; findAllByEntity2In(List&lt;Integer&gt; pChannels);
  </code></pre>
  
  <p>but it doesnt work now</p>
  
  <p>I catch an Enxception : </p>
  
  <p>\Caused by: java.lang.IllegalArgumentException: Parameter value element [2] did not match expected type [com.test.Entity2 (n/a)]</p>
  
  <p>Who knows how to solve?</p>
  
  <p>Thanks !</p>