protected void setImplicitTypes(Value val1, Value val2, Class expected) { super.setImplicitTypes(val1, val2, expected); // as well as setting the types for conversions, we also need to // ensure that any parameters are declared with the correct type, // since the JPA spec expects that these will be validated Parameter param = val1 instanceof Parameter ? (Parameter) val1 : val2 instanceof Parameter ? (Parameter) val2 : null; Path path = val1 instanceof Path ? (Path) val1 : val2 instanceof Path ? (Path) val2 : null; // we only check for parameter-to-path comparisons if (param == null || path == null || parameterTypes == null) return; FieldMetaData fmd = path.last(); if (fmd == null) return; Class type = path.isXPath() ? path.getType() : fmd.getType(); if (type == null) return; String paramName = param.getParameterName(); if (paramName == null) return; // make sure we have already declared the parameter if (parameterTypes.containsKey(paramName)) parameterTypes.put(paramName, type); }