hibernate/hibernate-orm · error · ConversionException

Could not determine neither the SqlTypedMapping nor the Bind

Error message

Could not determine neither the SqlTypedMapping nor the Bindable value for SqmParameter: {}

What it means

While registering JDBC parameters for a query parameter, both the bindable and the derived sqlTypedMapping were null, so no JDBC type or selectable could be attached to the parameter - translation fails with a ConversionException naming the SqmParameter. It is the binding-time surface of the same root cause as the parameter-mapping error.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/sqm/sql/spi/BaseSqmToSqlAstConverter.java:6726

				? jdbcParameters.getJdbcParameters().size()
				: castNonNull( jdbcParams.get( 0 ).get( 0 ).getParameterId() );
		final var bindable = bindable( valueMapping );
		if ( bindable instanceof SelectableMappings selectableMappings ) {
			selectableMappings.forEachSelectable(
					(index, selectableMapping)
							-> jdbcParameterConsumer.accept( index,
									new SqlTypedMappingJdbcParameter( selectableMapping, parameterId + index ) )
			);
		}
		else if ( bindable instanceof SelectableMapping selectableMapping ) {
			jdbcParameterConsumer.accept( 0,
					new SqlTypedMappingJdbcParameter( selectableMapping, parameterId ) );
		}
		else {
			final var sqlTypedMapping = sqlTypedMapping( expression, bindable );
			if ( sqlTypedMapping == null ) {
				if ( bindable == null ) {
					throw new ConversionException(
							"Could not determine neither the SqlTypedMapping nor the Bindable value for SqmParameter: " + expression );
				}
				bindable.forEachJdbcType(
						(index, jdbcMapping) -> jdbcParameterConsumer.accept(
								index,
								new JdbcParameterImpl( jdbcMapping, parameterId + index )
						)
				);
			}
			else {
				jdbcParameterConsumer.accept( 0,
						new SqlTypedMappingJdbcParameter( sqlTypedMapping, parameterId ) );
			}
		}
	}

	private SqlTypedMapping sqlTypedMapping(SqmParameter<?> expression, Bindable bindable) {
		if ( bindable instanceof BasicType<?> basicType) {

View on GitHub (pinned to fad1729dce)

Solutions

  1. Type every criteria parameter (cb.parameter with a real class) and keep each parameter inside the query that created it
  2. Guarantee a mapped path on the other side of any parameterized predicate
  3. Rebuild the query via createQuery after any criteria mutation instead of reusing a stale compiled query
  4. Upgrade Hibernate - several 'Could not determine neither SqlTypedMapping nor Bindable' cases were fixed in point releases

Example fix

// before
ParameterExpression p = cb.parameter(Object.class);
query.where(cb.equal(root.get("total"), p));

// after
ParameterExpression<BigDecimal> p = cb.parameter(BigDecimal.class);
query.where(cb.equal(root.get("total"), p));
Defensive patterns

Strategy: validation

Validate before calling

// Same guard as for parameter mapping: concrete types on all criteria parameters
boolean allTyped = query.getParameters().stream()
    .allMatch(p -> p.getParameterType() != null && p.getParameterType() != Object.class);
if (!allTyped) {
    throw new IllegalStateException("Refusing to run query with untyped parameters");
}

Try / catch

try {
    return query.getResultList();
} catch (RuntimeException e) {
    if (e.getClass().getSimpleName().equals("ConversionException")
            && e.getMessage() != null && e.getMessage().contains("SqlTypedMapping")) {
        log.error("JDBC parameter without type - rebuild query with typed parameters");
    }
    throw e;
}

Prevention

When it happens

Trigger: Criteria parameters with no type information reaching JDBC registration; parameters whose JpaCriteriaParameter resolution was lost (parameter object not part of the compiled tree); null bindings in positions with no inferable type; reused query objects after criteria mutation.

Common situations: Same contexts as untyped criteria parameters - dynamic filter builders, generic repositories, cross-query parameter reuse; often appears only at runtime on specific parameter combinations.

Related errors


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