{"record":{"id":"661e601d517b7a95","repo":"hibernate/hibernate-orm","slug":"could-not-normalize-compound-natural-id-value-s","errorCode":null,"errorMessage":"Could not normalize compound natural id value: %s","messagePattern":"Could not normalize compound natural id value: (.+?)","errorType":"exception","errorClass":"UnsupportedMappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/CompoundNaturalIdMapping.java","lineNumber":752,"sourceCode":"\t\treturn new KeyClassNormalizer( keyAttributes, naturalIdClass, attributeMappers );\n\t}\n\n\tstatic class ValueNormalizerSupport implements ValueNormalizer {\n\t\tprivate final List<SingularAttributeMapping> naturalIdAttributes;\n\n\t\tpublic ValueNormalizerSupport(List<SingularAttributeMapping> naturalIdAttributes) {\n\t\t\tthis.naturalIdAttributes = naturalIdAttributes;\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean isInstance(Object value) {\n\t\t\treturn value instanceof Map;\n\t\t}\n\n\t\t@Override\n\t\tpublic Object[] normalize(Object incoming) {\n\t\t\tif ( !isInstance( incoming ) ) {\n\t\t\t\tthrow new UnsupportedMappingException( \"Could not normalize compound natural id value: \" + incoming );\n\t\t\t}\n\t\t\tfinal var values = new Object[naturalIdAttributes.size()];\n\t\t\t//noinspection unchecked\n\t\t\tfinal Map<String,Object> valuesMap = (Map<String,Object>) incoming;\n\t\t\tfor ( int i = 0; i < naturalIdAttributes.size(); i++ ) {\n\t\t\t\tvalues[i] = valuesMap.get( naturalIdAttributes.get( i ).getAttributeName() );\n\t\t\t}\n\t\t\treturn values;\n\t\t}\n\n\t\t@Override\n\t\tpublic Class<?> getIdClassType() {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\t/// Responsible for decomposing a value of the NaturalIdClass into the internal array format\n\tstatic class KeyClassNormalizer<T> extends ValueNormalizerSupport {","sourceCodeStart":734,"sourceCodeEnd":770,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/CompoundNaturalIdMapping.java#L734-L770","documentation":"Error \"Could not normalize compound natural id value: %s\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown when a compound natural id value (map or array) cannot be normalized into the internal per-attribute representation.","commonSituations":"See trigger scenarios.","solutions":["Check the natural-id attribute values for nulls or types that cannot be normalized; supply a complete, correctly-typed natural id value."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}