public static void setConstants(
            org.hibernate.query.Query<?> query,
            List<Object> constants,
            Map<ParamExpression<?>, Object> params
    ) {
        for (int i = 0; i < constants.size(); i++) {
            Object val = constants.get(i);

            if (val instanceof Param) {
                Param<?> param = (Param<?>) val;
                val = params.get(val);
                if (val == null) {
                    throw new ParamNotSetException(param);
                }
            }

            setValueWithNumberedLabel(query, i + 1, val);
        }
    }
{@code HibernateUtil} provides static utility methods for Hibernate

@author tiwe
querydsl-jpa/src/main/java/com/querydsl/jpa/hibernate/HibernateUtil.java