If I pass an empty list into a JPA query, I get an error. For example:
List municipalities = myDao.findAll(); // returns empty list
em.c
According to the section 4.6.8 In Expressions from the JPA 1.0 specification:
There must be at least one element in the comma separated list that defines the set of values for the
INexpression.
In other words, regardless of Hibernate's ability to parse the query and to pass an IN(), regardless of the support of this syntax by particular databases (PosgreSQL doesn't according to the Jira issue), you should use a dynamic query here if you want your code to be portable (and I usually prefer to use the Criteria API for dynamic queries).