In JPA, in creating the query, we could perform
(" ... where a.name = :name ...")
.setParameter("name", user.getName());
However, I am hoping if there might be some way in JPQL that I could do:
(" ... where a.name in (:namelist) ...")
.setParameter("namelist", (List<String>)names);
or
" ... where a.name in (:namelist) ...")
.setParameter("namelist", (String[])names);
Does not have to be exactly how I exemplified above. I am looking for any convenient way to build an IN (or NOT IN) list into the query. Any form of suggestions will be welcome. Perhaps, there is an Apache util?
Otherwise, I would have to construct the query and iteratively insert the items into the IN list.
Starting with JPA2 it should work out of the box for:
where :param is a collection of the proper type. Like: