title: JPA passing list to IN clause in named native query
body: <p>I know I can pass a list to named query in JPA, but how about NamedNativeQuery? I have tried many ways but still can't just pass the list to a NamedNativeQuery. Anyone know how to pass a list to the in clause in NamedNativeQuery? Thank you very much!</p>
  
  <p>The NamedNativeQuery is as below:</p>
  
  <pre><code>@NamedNativeQuery(
     name="User.findByUserIdList", 
     query="select u.user_id, u.dob, u.name, u.sex, u.address from user u "+
           "where u.user_id in (?userIdList)"
  )
  </code></pre>
  
  <p>and it is called like this:</p>
  
  <pre><code>List&lt;Object[]&gt; userList = em.createNamedQuery("User.findByUserIdList").setParameter("userIdList", list).getResultList();
  </code></pre>
  
  <p>However the result is not as I expected.</p>
  
  <pre><code>System.out.println(userList.size());  //output 1
  
  Object[] user = userList.get(0);
  System.out.println(user.length);   //expected 5 but result is 3
  System.out.println(user[0]);       //output MDAVERSION which is not a user_id
  System.out.println(user[1]);       //output 5
  System.out.println(user[2]);       //output 7
  </code></pre>