hibernate/hibernate-orm · error · QueryException
JSON path [{}] uses parameter [{}] that is not passed
Error message
JSON path [{}] uses parameter [{}] that is not passed What it means
Like the other SingleStore JSON emulations, json_array_insert renders every path element as a constant attribute or index. buildJsonPath walks the leading path elements and throws QueryException when it finds a [$name] parameter marker (JsonParameterIndexAccess) whose parameter was not passed, because SingleStore has no passing support.
Source
Thrown at hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/function/json/SingleStoreJsonArrayInsertFunction.java:105
return value instanceof UnparsedNumericLiteral<?>;
}
private static void buildJsonArrayInsertValue(SqlAppender sqlAppender, SqlAstNode value) {
sqlAppender.appendSql( "json_splice_" );
sqlAppender.appendSql( isNumeric( value ) ? "double(" : "string(" );
}
private static void buildJsonPath(
SqlAppender sqlAppender, Expression jsonPath, List<JsonPathHelper.JsonPathElement> jsonPathElements) {
for ( int i = 0; i < jsonPathElements.size() - 1; i++ ) {
JsonPathHelper.JsonPathElement pathElement = jsonPathElements.get( i );
sqlAppender.appendSql( ',' );
if ( pathElement instanceof JsonPathHelper.JsonAttribute attribute ) {
sqlAppender.appendSingleQuoteEscapedString( attribute.attribute() );
}
else if ( pathElement instanceof JsonPathHelper.JsonParameterIndexAccess jsonPathElement) {
final String parameterName = jsonPathElement.parameterName();
throw new QueryException( "JSON path [" + jsonPath + "] uses parameter [" + parameterName + "] that is not passed" );
}
else {
sqlAppender.appendSql( '\'' );
sqlAppender.appendSql( ( (JsonPathHelper.JsonIndexAccess) pathElement ).index() );
sqlAppender.appendSql( '\'' );
}
}
}
}
View on GitHub (pinned to fad1729dce)
Solutions
- Inline the concrete index into the path literal in Java before creating the query
- Restrict json_array_insert on SingleStore to fully literal paths
- Execute one statement per concrete position instead of parameterizing inside the path
- Fall back to a native SingleStore statement for dynamic paths
Example fix
// before
json_array_insert(e.doc, 'items[$i][0]', :v)
// after: build the literal path in Java
String path = "items[" + index + "][0]";
em.createQuery("update E e set e.doc = json_array_insert(e.doc, '" + path + "', :v)")
.setParameter("v", v).executeUpdate(); Defensive patterns
Strategy: validation
Validate before calling
private static final Pattern PARAM_IN_PATH = Pattern.compile("\\[\\s*\\$\\w+");
static String requireLiteralPath(String path) {
if (PARAM_IN_PATH.matcher(path).find()) {
throw new IllegalArgumentException("Inline the index instead of [$param]: " + path);
}
return path;
} Try / catch
try {
em.createQuery(hql).executeUpdate(); // json_array_insert with [$i] path
} catch (QueryException e) {
if (e.getMessage() != null && e.getMessage().contains("that is not passed")) {
// inline concrete indices into the path literal and retry
}
throw e;
} Prevention
- Keep json_array_insert paths fully literal on SingleStore
- Generate one statement per concrete index rather than parameterizing positions
- Share the [$param] path validator across all SingleStore JSON functions
When it happens
Trigger: HQL `json_array_insert(e.doc, 'items[$i][0]', :v)` — any parameter marker in the non-final path segments — on SingleStoreDialect.
Common situations: Dynamic array navigation shared across dialects; queries copied from PostgreSQL-flavored HQL that rely on a passing clause.
Related errors
- JSON path [{}] uses parameter [{}] that is not passed
- SingleStore json_array_insert function requires at least one
- SingleStore json_array_insert function last path parameter m
- JSON path [{}] uses parameter [{}] that is not passed
- SingleStore json_exists only support literal json paths, but
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/2fbb91eaf874d13c.
Report an issue: GitHub.