Actually there are two bugs hidden in this one. 1. First when I use setParameter
Query query = session.createQuery("SELECT user FROM User user WHERE user.id IN (:ids) AND user.status = (:status)");
map.put("ids", idList);
...
query.setParameter("status",status); query.setProperties(map);
This query works, but the setProperties actually overwrites the value with NULL set up already by setParameter. 2. I use setParameterList
Query query = session.createQuery("SELECT user FROM User user WHERE user.id IN (:ids) AND user.status = (:statuses)");
map.put("ids", idList);
...
query.setParameterList("statuses",statusList); query.setProperties(map);
Then query fails on different number in namedParameters.size() + namedParametersList.size() in AbstractQueryImpl#verifyParameters(). As the setProperties map set ups 2 parameters inside namedParameters and 1 parameter in namedParameterLists. But apparently number of parameters is only 2. I believe that something like map.contains() check in setProperies could fix both issue. |