hibernate/hibernate-orm · error · FunctionArgumentException

Parameter %d of function '%s()' has type '%s', but argument

Error message

Parameter %d of function '%s()' has type '%s', but argument is of type '%s'

What it means

Error "Parameter %d of function '%s()' has type '%s', but argument is of type '%s'" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/sqm/produce/function/ArgumentTypesValidator.java:271

					|| jdbcType.isSmallInteger();
			case TEMPORAL -> jdbcType.isTemporal();
			case DATE -> jdbcType.hasDatePart();
			case TIME -> jdbcType.hasTimePart();
			case BINARY -> jdbcType.isBinary();
			case SPATIAL -> jdbcType.isSpatial();
			case JSON -> jdbcType.isJson();
			case IMPLICIT_JSON -> jdbcType.isImplicitJson();
			case XML -> jdbcType.isXml();
			case IMPLICIT_XML -> jdbcType.isImplicitXml();
			case ENUM -> javaType instanceof Class<?> clz && clz.isEnum();
			default -> true; // TODO: should we throw here?
		};
	}

	private static void throwError(
			FunctionParameterType type, Type javaType, String sqlType, String functionName, int paramNumber) {
		if ( sqlType == null ) {
			throw new FunctionArgumentException(
					String.format(
							"Parameter %d of function '%s()' has type '%s', but argument is of type '%s'",
							paramNumber,
							functionName,
							type,
							javaType.getTypeName()
					)
			);
		}
		else {
			throw new FunctionArgumentException(
					String.format(
							"Parameter %d of function '%s()' has type '%s', but argument is of type '%s' mapped to '%s'",
							paramNumber,
							functionName,
							type,
							javaType.getTypeName(),
							sqlType

View on GitHub (pinned to fad1729dce)

Solutions

  1. The argument's type does not match the function parameter's declared type.
  2. Cast the argument to the required type or pass a value of the correct type.

When it happens

Trigger: A function call in a query supplies arguments that violate the function's signature.

Common situations: Passing the wrong number or types of arguments (e.g. untyped nulls, tuples) to HQL/SQL functions.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/eae416fa7f7ded68. Report an issue: GitHub.