hibernate/hibernate-orm · error · FunctionArgumentException
Unsupported type '%s' for function '%s()'. Only integral, de
Error message
Unsupported type '%s' for function '%s()'. Only integral, decimal and timestamp types are supported.
What it means
The final branch of GenerateSeriesArgumentValidator: only integral, decimal, and temporal JDBC types are accepted as the series bounds. A start argument of any other type — String, Boolean, UUID, enum, byte[] — throws this FunctionArgumentException stating the unsupported type and function name.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/dialect/function/GenerateSeriesArgumentValidator.java:110
)
);
}
if ( stepType == null ) {
throw unknownType( functionName, arguments, 2 );
}
final var stepJdbcType = ((JdbcMapping) stepType).getJdbcType();
if ( !stepJdbcType.isInterval() && !stepJdbcType.isDuration() ) {
throw new FunctionArgumentException(
String.format(
"Step parameter of function '%s()' is of type '%s', but must be of type interval",
functionName,
stepType.getTypeName()
)
);
}
}
else {
throw new FunctionArgumentException(
String.format(
"Unsupported type '%s' for function '%s()'. Only integral, decimal and timestamp types are supported.",
startType.getTypeName(),
functionName
)
);
}
}
private FunctionArgumentException unknownType(String functionName, List<? extends SqmTypedNode<?>> arguments, int parameterIndex) {
return new FunctionArgumentException(
String.format(
"Couldn't determine type of parameter %d of function '%s()'. Argument is '%s'",
parameterIndex,
functionName,
arguments.get( parameterIndex )
)
);View on GitHub (pinned to fad1729dce)
Solutions
- Generate the character/other series in Java (loop, IntStream/Stream) and pass it as a values list or temp table instead of generate_series
- Cast/convert the argument to a numeric or timestamp type before the call if the data is really numeric (cast(e.n as integer))
- Bind typed parameters so validation sees numeric/temporal types
Example fix
// before
session.createQuery("select gs from generate_series(:lo, :hi) gs")
.setParameter("lo", "1").setParameter("hi", "10"); // String bounds
// after
session.createQuery("select gs from generate_series(cast(:lo as integer), cast(:hi as integer)) gs")
.setParameter("lo", "1").setParameter("hi", "10"); Defensive patterns
Strategy: type-guard
Validate before calling
boolean isSeriesEligible(Object bound) {
return bound instanceof Number || bound instanceof java.time.temporal.Temporal;
} Type guard
boolean isSeriesEligible(Object bound) {
return bound instanceof Number || bound instanceof java.time.temporal.Temporal;
} Try / catch
catch (FunctionArgumentException e) {
if (e.getMessage().contains("Unsupported type")) {
return generateSeriesInJava(lo, hi); // fallback for non-numeric series
}
throw e;
} Prevention
- Generate non-numeric series (letters, codes) in application code, not via generate_series
- Bind parameters with explicit numeric/temporal type classes
- Validate user-supplied series bounds against a whitelist before composing HQL
When it happens
Trigger: generate_series('a','z') (String bounds), generate_series(:ids) with UUID parameters, or passing an enum/bit field; also arises when bind parameters are untyped/null at validation time so their expressible resolves to a non-numeric type.
Common situations: Trying to generate character series like PostgreSQL's generate_series('a','z'); dynamic queries where the first argument is user-controlled and can be non-numeric; criteria code reusing a generic series helper with the wrong parameter type.
Related errors
- Start and stop parameters of function '%s()' must be of the
- Step parameter of function '%s()' is of type '%s', but must
- Function %s() requires exactly 3 arguments when invoked with
- Step parameter of function '%s()' is of type '%s', but must
- Couldn't determine types of arguments to function 'generate_
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/8f343332d99fb10e.
Report an issue: GitHub.