hibernate/hibernate-orm · error · UnsupportedOperationException
Support for embedded-valued parameters not yet implemented
Error message
Support for embedded-valued parameters not yet implemented
What it means
A query parameter whose SQM type is an embeddable (CompositeSqmPathSource or EmbeddableDomainType) reached parameter-type resolution. Hibernate tries to infer the value mapping from the other side of the comparison; when nothing inferable exists, it throws UnsupportedOperationException because embedded-valued parameters are not implemented.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/sqm/sql/spi/BaseSqmToSqlAstConverter.java:6632
final var paramSqmType = creationContext.resolveExpressible( paramType );
if ( paramSqmType instanceof SqmPath<?> sqmPath ) {
final var modelPart = determineValueMapping( sqmPath );
if ( modelPart instanceof PluralAttributeMapping pluralAttributeMapping ) {
return resolveInferredValueMappingForParameter( pluralAttributeMapping.getElementDescriptor() );
}
return modelPart;
}
else if ( paramSqmType instanceof BasicValuedMapping basicValuedMapping ) {
return basicValuedMapping;
}
else if ( paramSqmType instanceof CompositeSqmPathSource || paramSqmType instanceof EmbeddableDomainType<?> ) {
// Try to infer the value mapping since the other side apparently is a path source
final var inferredValueMapping = getInferredValueMapping();
if ( inferredValueMapping != null ) {
return resolveInferredValueMappingForParameter( inferredValueMapping );
}
else {
throw new UnsupportedOperationException( "Support for embedded-valued parameters not yet implemented" );
}
}
else if ( paramSqmType instanceof AnyDiscriminatorSqmPathSource<?> anyDiscriminatorSqmPathSource ) {
return (MappingModelExpressible<?>) anyDiscriminatorSqmPathSource.getPathType();
}
else if ( paramSqmType instanceof SqmPathSource<?> || paramSqmType instanceof BasicDomainType<?> ) {
// Try to infer the value mapping since the other side apparently is a path source
final var inferredMapping = resolveInferredType();
if ( inferredMapping instanceof PluralAttributeMapping pluralAttributeMapping ) {
return resolveInferredValueMappingForParameter( pluralAttributeMapping.getElementDescriptor() );
}
else if ( inferredMapping != null && !( inferredMapping instanceof JavaObjectType ) ) {
// Do not report back the "object type" as inferred type and instead try to rely on the paramSqmType.getExpressibleJavaType()
return resolveInferredValueMappingForParameter( inferredMapping );
}
else {
final var parameterJavaType = paramSqmType.getExpressibleJavaType().getJavaTypeClass();
final var basicTypeForJavaType =View on GitHub (pinned to fad1729dce)
Solutions
- Compare the embeddable's fields individually: 'where e.address.city = :city and e.address.zip = :zip'
- If the embeddable wraps a single value, expose and compare that value instead
- For read queries needing struct comparison, use a native SQL query with the dialect's struct support
- Track/vote on the Hibernate JIRA for embedded-valued parameter support and upgrade - inference keeps improving
Example fix
// before select e from Emp e where e.address = :addr // after select e from Emp e where e.address.city = :city and e.address.zip = :zip
Defensive patterns
Strategy: fallback
Validate before calling
// Reject whole-embeddable parameters before query execution
Class<?> paramType = expectedParamType; // from your query builder metadata
if (paramType != null && java.lang.reflect.Modifier.isInterface(paramType.getModifiers()) == false) {
// cheap heuristic: embeddables have @Embeddable / @Embedded
if (paramType.isAnnotationPresent(jakarta.persistence.Embeddable.class)) {
throw new UnsupportedOperationException("Compare embeddable fields individually, not the whole object");
}
} Try / catch
try {
return session.createQuery(hql).getResultList();
} catch (UnsupportedOperationException e) {
if ("Support for embedded-valued parameters not yet implemented".equals(e.getMessage())) {
return runFieldWiseComparison(entityManager); // rewrite: compare e.address.city/zip
}
throw e;
} Prevention
- Compare embeddables field by field in queries
- Model single-value wrappers as basic types with a converter instead of embeddables when compared often
- Watch the Hibernate JIRA for embedded-parameter support before upgrading assumptions
When it happens
Trigger: HQL 'where e.address = :addr' with an @Embeddable Address parameter and no mapped path on the other side to infer from; criteria predicates cb.equal(root.get("address"), addressParam); updates setting an embeddable as a whole via parameter.
Common situations: Applications modeling value objects as embeddables and trying to compare them as a whole; migrating JPQL that compared component types; code ported from other ORMs where struct comparison is supported.
Related errors
- Composite query parameter cannot be used in select
- Embeddable paths cannot be TREAT-ed to an entity type
- Embeddable paths cannot be TREAT-ed
- Cannot dereference an embeddable name
- Could not resolve attribute '${name}' of '${returnedClassNam
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/1e22c0aa47eba2d4.
Report an issue: GitHub.