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
The above accepted answer is not correct and led me off track for many days !!
JPA and Hibernate both accept collections in native query using Query.
You just need to do
String nativeQuery = "Select * from A where name in :names"; //use (:names) for older versions of hibernate
Query q = em.createNativeQuery(nativeQuery);
q.setParameter("names", l);
Also refer the answers here which suggest the same (I picked the above example from one of them)