{"record":{"id":"8f343332d99fb10e","repo":"hibernate/hibernate-orm","slug":"unsupported-type-s-for-function-s-only-in","errorCode":null,"errorMessage":"Unsupported type '%s' for function '%s()'. Only integral, decimal and timestamp types are supported.","messagePattern":"Unsupported type '(.+?)' for function '(.+?)\\(\\)'\\. Only integral, decimal and timestamp types are supported\\.","errorType":"exception","errorClass":"FunctionArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/dialect/function/GenerateSeriesArgumentValidator.java","lineNumber":110,"sourceCode":"\t\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t\tif ( stepType == null ) {\n\t\t\t\tthrow unknownType( functionName, arguments, 2 );\n\t\t\t}\n\t\t\tfinal var stepJdbcType = ((JdbcMapping) stepType).getJdbcType();\n\t\t\tif ( !stepJdbcType.isInterval() && !stepJdbcType.isDuration() ) {\n\t\t\t\tthrow new FunctionArgumentException(\n\t\t\t\t\t\tString.format(\n\t\t\t\t\t\t\t\t\"Step parameter of function '%s()' is of type '%s', but must be of type interval\",\n\t\t\t\t\t\t\t\tfunctionName,\n\t\t\t\t\t\t\t\tstepType.getTypeName()\n\t\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tthrow new FunctionArgumentException(\n\t\t\t\t\tString.format(\n\t\t\t\t\t\t\t\"Unsupported type '%s' for function '%s()'. Only integral, decimal and timestamp types are supported.\",\n\t\t\t\t\t\t\tstartType.getTypeName(),\n\t\t\t\t\t\t\tfunctionName\n\t\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate FunctionArgumentException unknownType(String functionName, List<? extends SqmTypedNode<?>> arguments, int parameterIndex) {\n\t\treturn new FunctionArgumentException(\n\t\t\t\tString.format(\n\t\t\t\t\t\t\"Couldn't determine type of parameter %d of function '%s()'. Argument is '%s'\",\n\t\t\t\t\t\tparameterIndex,\n\t\t\t\t\t\tfunctionName,\n\t\t\t\t\t\targuments.get( parameterIndex )\n\t\t\t\t)\n\t\t);","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/function/GenerateSeriesArgumentValidator.java#L92-L128","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nsession.createQuery(\"select gs from generate_series(:lo, :hi) gs\")\n        .setParameter(\"lo\", \"1\").setParameter(\"hi\", \"10\"); // String bounds\n\n// after\nsession.createQuery(\"select gs from generate_series(cast(:lo as integer), cast(:hi as integer)) gs\")\n        .setParameter(\"lo\", \"1\").setParameter(\"hi\", \"10\");","handlingStrategy":"type-guard","validationCode":"boolean isSeriesEligible(Object bound) {\n    return bound instanceof Number || bound instanceof java.time.temporal.Temporal;\n}","typeGuard":"boolean isSeriesEligible(Object bound) {\n    return bound instanceof Number || bound instanceof java.time.temporal.Temporal;\n}","tryCatchPattern":"catch (FunctionArgumentException e) {\n    if (e.getMessage().contains(\"Unsupported type\")) {\n        return generateSeriesInJava(lo, hi); // fallback for non-numeric series\n    }\n    throw e;\n}","preventionTips":["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"],"tags":["hibernate","hql","generate-series","unsupported-type","function-validation"],"backgroundTag":"hql-function-argument-type-mismatch","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}