{"record":{"id":"1e22c0aa47eba2d4","repo":"hibernate/hibernate-orm","slug":"support-for-embedded-valued-parameters-not-yet-imp","errorCode":null,"errorMessage":"Support for embedded-valued parameters not yet implemented","messagePattern":"Support for embedded-valued parameters not yet implemented","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/sqm/sql/spi/BaseSqmToSqlAstConverter.java","lineNumber":6632,"sourceCode":"\t\tfinal var paramSqmType = creationContext.resolveExpressible( paramType );\n\t\tif ( paramSqmType instanceof SqmPath<?> sqmPath ) {\n\t\t\tfinal var modelPart = determineValueMapping( sqmPath );\n\t\t\tif ( modelPart instanceof PluralAttributeMapping pluralAttributeMapping ) {\n\t\t\t\treturn resolveInferredValueMappingForParameter( pluralAttributeMapping.getElementDescriptor() );\n\t\t\t}\n\t\t\treturn modelPart;\n\t\t}\n\t\telse if ( paramSqmType instanceof BasicValuedMapping basicValuedMapping ) {\n\t\t\treturn basicValuedMapping;\n\t\t}\n\t\telse if ( paramSqmType instanceof CompositeSqmPathSource || paramSqmType instanceof EmbeddableDomainType<?> ) {\n\t\t\t// Try to infer the value mapping since the other side apparently is a path source\n\t\t\tfinal var inferredValueMapping = getInferredValueMapping();\n\t\t\tif ( inferredValueMapping != null ) {\n\t\t\t\treturn resolveInferredValueMappingForParameter( inferredValueMapping );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new UnsupportedOperationException( \"Support for embedded-valued parameters not yet implemented\" );\n\t\t\t}\n\t\t}\n\t\telse if ( paramSqmType instanceof AnyDiscriminatorSqmPathSource<?> anyDiscriminatorSqmPathSource ) {\n\t\t\treturn (MappingModelExpressible<?>) anyDiscriminatorSqmPathSource.getPathType();\n\t\t}\n\t\telse if ( paramSqmType instanceof SqmPathSource<?> || paramSqmType instanceof BasicDomainType<?> ) {\n\t\t\t// Try to infer the value mapping since the other side apparently is a path source\n\t\t\tfinal var inferredMapping = resolveInferredType();\n\t\t\tif ( inferredMapping instanceof PluralAttributeMapping pluralAttributeMapping ) {\n\t\t\t\treturn resolveInferredValueMappingForParameter( pluralAttributeMapping.getElementDescriptor() );\n\t\t\t}\n\t\t\telse if ( inferredMapping != null && !( inferredMapping instanceof JavaObjectType ) ) {\n\t\t\t\t// Do not report back the \"object type\" as inferred type and instead try to rely on the paramSqmType.getExpressibleJavaType()\n\t\t\t\treturn resolveInferredValueMappingForParameter( inferredMapping );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tfinal var parameterJavaType = paramSqmType.getExpressibleJavaType().getJavaTypeClass();\n\t\t\t\tfinal var basicTypeForJavaType =","sourceCodeStart":6614,"sourceCodeEnd":6650,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/spi/BaseSqmToSqlAstConverter.java#L6614-L6650","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nselect e from Emp e where e.address = :addr\n\n// after\nselect e from Emp e where e.address.city = :city and e.address.zip = :zip","handlingStrategy":"fallback","validationCode":"// Reject whole-embeddable parameters before query execution\nClass<?> paramType = expectedParamType; // from your query builder metadata\nif (paramType != null && java.lang.reflect.Modifier.isInterface(paramType.getModifiers()) == false) {\n    // cheap heuristic: embeddables have @Embeddable / @Embedded\n    if (paramType.isAnnotationPresent(jakarta.persistence.Embeddable.class)) {\n        throw new UnsupportedOperationException(\"Compare embeddable fields individually, not the whole object\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    return session.createQuery(hql).getResultList();\n} catch (UnsupportedOperationException e) {\n    if (\"Support for embedded-valued parameters not yet implemented\".equals(e.getMessage())) {\n        return runFieldWiseComparison(entityManager); // rewrite: compare e.address.city/zip\n    }\n    throw e;\n}","preventionTips":["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"],"tags":["hibernate","hql","embeddable","query-parameter","unsupported-feature"],"backgroundTag":"embeddable-parameter-unsupported","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}