title: JPA TypedQuery: Parameter value element did not match expected type
body: <p>I am using JPA 2.0 and having following code in DAO layer:</p>
  
  <pre><code>public void test() {
    String key = "status";
    String[] statuses = {"A", "B"};
    List&lt;TestTable&gt; result = find(key, statuses);
  }
  
  public List&lt;TestTable&gt; find(String key, Object valueArr) {
    String sql = "SELECT nd FROM TestTable nd WHERE nd." + key + " IN :" + key;
    TypedQuery&lt;TestTable&gt; query = entityManager.createQuery(sql, TestTable.class);
    query.setParameter(key, Arrays.asList(valueArr))//***Error Line***
    return query.getResultList();
  }
  </code></pre>
  
  <p>In the above Error Line it throws following exception:</p>
  
  <pre><code>java.lang.IllegalArgumentException: Parameter value element [[Ljava.lang.String;@cbe5bc] did not match expected type [java.lang.String]
  </code></pre>
  
  <p>Why it expected type is String whereas actually it is String[] ? Please help!</p>
  
  <p>Note: This is the extracted and simplified code from the generic routine I cannot change the 'Object valueArr' to String[] because its being used for others...</p>