title: IN clause with Spring Data and Cassandra @Query
body: <p>I'm trying to query a Cassandra table using the IN clause and the @Query annotation from Spring Data.  I have a table with a partition key of last_name and a clustering key of first_name.</p>
  
  <p>I have this query working</p>
  
  <pre><code>@Query("SELECT * FROM people WHERE last_name=?0")
  public List&lt;People&gt; findByLastName(String lastName);
  </code></pre>
  
  <p>and I would like to do something like</p>
  
  <pre><code>@Query("SELECT * FROM people WHERE last_name=?0 AND first_name IN ?1")
  public List&lt;People&gt; findByLastName(String lastName, String[] firstName);
  </code></pre>
  
  <p>I have it working using</p>
  
  <pre><code>CassandraOperations.select("SELECT * FROM people WHERE last_name=" + lastName + 
  " AND first_name IN (" + concatinatedNameList + ")", People.class);
  </code></pre>
  
  <p>But for a number of reasons (code style, testing, I swear there are more) I would prefer to use @Query.  Any ideas?</p>
  
  <p><strong>EDIT FOR MORE INFO!</strong></p>
  
  <p>Passing in an array, set, or list returns <code>Caused by: java.lang.IllegalArgumentException: encountered unsupported query parameter type [class [Ljava.lang.String;] in method public abstract</code></p>
  
  <p>Also tried:</p>
  
  <pre><code>String firstName = "Joe,Jim";
  @Query("SELECT * FROM people WHERE last_name=?0 AND first_name IN (?1)")
  public List&lt;People&gt; findByLastName(String lastName, String firstName);
  </code></pre>
  
  <p>Nothing found, library searches for a single person with a concatinated name <code>('Joe,Jim')</code></p>
  
  <pre><code>String firstName = "'Joe','Jim'";
  @Query("SELECT * FROM people WHERE last_name=?0 AND first_name IN (?1)")
  public List&lt;People&gt; findByLastName(String lastName, String firstName);
  </code></pre>
  
  <p>Nothing found, the request is escaped and ends up <code>('''Joe'',''Jim''')</code></p>
  
  <pre><code>String firstName = "Joe','Jim"; // Hoping the library would just add the outer quotes, getting desperate
  @Query("SELECT * FROM people WHERE last_name=?0 AND first_name IN (?1)")
  public List&lt;People&gt; findByLastName(String lastName, String firstName);
  </code></pre>
  
  <p>Nothing found, the request is escaped and ends up <code>('Joe'',''Jim')</code></p>