title: Native query in Spring Boot with WHERE condition for tuple in list
body: <p>When sending plain SQL to PostgreSQL like the following:</p>
  
  <pre><code>CREATE TABLE things (
      id      BIGINT PRIMARY KEY NOT NULL,
      foo     BIGINT NOT NULL,
      bar     BIGINT NOT NULL
  );
  
  
  INSERT INTO things VALUES (9900, 1, 2);
  INSERT INTO things VALUES (9901, 3, 4);
  INSERT INTO things VALUES (9902, 1, 4);
  SELECT * FROM things WHERE foo IN (1, 2);
  SELECT * FROM things WHERE (foo, bar) IN (VALUES (1, 2), (3, 4));
  </code></pre>
  
  <p>it works as expected.</p>
  
  <p>However when trying to do the same thing using Spring Boot, it fails. Here is my minimal example (Kotlin):</p>
  
  <p>The entity:</p>
  
  <pre><code>import org.springframework.data.jpa.domain.AbstractPersistable
  import javax.persistence.Entity
  import javax.persistence.Table
  
  @Entity
  @Table(name = "things")
  class Thing(
          val foo: Long,
          val bar: Long
  ) : AbstractPersistable&lt;Long&gt;()
  </code></pre>
  
  <p>The repository:</p>
  
  <pre><code>import org.springframework.data.jpa.repository.JpaRepository
  import org.springframework.data.jpa.repository.Query
  
  interface ThingRepository : JpaRepository&lt;Thing, Long&gt; {
  
      @Query(nativeQuery = true, value = "SELECT * FROM things WHERE foo IN (1, 2);")
      fun selectNativeByFoo(): Iterable&lt;Thing&gt;
  
      @Query(nativeQuery = true, value = "SELECT * FROM things WHERE (foo, bar) IN (VALUES (1, 2), (3, 4));")
      fun selectNativeByFooAndBar(): Iterable&lt;Thing&gt;
  }
  </code></pre>
  
  <p>A call to <code>selectNativeByFoo</code> works fine, but calling <code>selectNativeByFooAndBar</code> fails with the following exception:</p>
  
  <pre><code>org.springframework.dao.InvalidDataAccessResourceUsageException: could not prepare statement; SQL [SELECT * FROM things WHERE (foo, bar) IN (VALUES (1, 2), (3, 4));]; nested exception is org.hibernate.exception.SQLGrammarException: could not prepare statement
  
  
  Caused by: org.h2.jdbc.JdbcSQLException: Invalid parameter count for "VALUES", expected count: "1"; SQL statement:
  SELECT * FROM things WHERE (foo, bar) IN (VALUES (1, 2), (3, 4)); [7001-197]
  </code></pre>
  
  <p>What am I doing wrong?</p>