{"record":{"id":"c955fed28905c5ed","repo":"hibernate/hibernate-orm","slug":"could-not-resolve-named-type-hibernatetypena","errorCode":null,"errorMessage":"Could not resolve named type : \" + hibernateTypeName","messagePattern":"Could not resolve named type : \" \\+ hibernateTypeName","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/query/HbmResultSetMappingDescriptor.java","lineNumber":958,"sourceCode":"\t\t}\n\n\t\tpublic ScalarDescriptor(JaxbHbmNativeQueryScalarReturnType hbmScalarReturn) {\n\t\t\tthis( hbmScalarReturn.getColumn(), hbmScalarReturn.getType() );\n\t\t}\n\n\t\t@Nonnull\n\t\t@Override\n\t\tpublic ResultMementoBasicStandard resolve(@Nonnull ResultSetMappingResolutionContext resolutionContext) {\n\t\t\tBootQueryLogging.BOOT_QUERY_LOGGER.tracef(\n\t\t\t\t\t\"Resolving HBM ScalarDescriptor into memento - %s\",\n\t\t\t\t\tcolumnName\n\t\t\t);\n\t\t\tif ( hibernateTypeName != null ) {\n\t\t\t\tfinal var namedType =\n\t\t\t\t\t\tresolutionContext.getTypeConfiguration().getBasicTypeRegistry()\n\t\t\t\t\t\t\t\t.getRegisteredType( hibernateTypeName );\n\t\t\t\tif ( namedType == null ) {\n\t\t\t\t\tthrow new IllegalArgumentException( \"Could not resolve named type : \" + hibernateTypeName );\n\t\t\t\t}\n\t\t\t\treturn new ResultMementoBasicStandard( columnName, namedType );\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// todo (6.0) : column name may be optional in HBM - double check\n\t\t\t\treturn new ResultMementoBasicStandard( columnName, null );\n\t\t\t}\n\t\t}\n\t}\n}\n","sourceCodeStart":940,"sourceCodeEnd":969,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/query/HbmResultSetMappingDescriptor.java#L940-L969","documentation":"When a <return-scalar/> declares a type attribute, ScalarDescriptor.resolve() looks the name up in the BasicTypeRegistry (resolutionContext.getTypeConfiguration().getBasicTypeRegistry().getRegisteredType(hibernateTypeName)). An unknown name yields null and this IllegalArgumentException is thrown. Only names registered as Hibernate basic types (built-ins like 'string', 'integer', 'uuid', plus any custom types contributed to the registry) are resolvable here.","triggerScenarios":"<return-scalar column=\"TOTAL\" type=\"monny\"/> (typo); using a custom UserType name that was never registered as a basic type in this bootstrap; using JDBC type names like 'VARCHAR' instead of Hibernate type names; version differences where a type name was renamed.","commonSituations":"Typos in type attributes; custom basic types contributed in one persistence unit but used in a mapping loaded by another; Hibernate 3/4 type names that no longer exist under Hibernate 6's type registry.","solutions":["Correct the type name to a registered Hibernate basic type (e.g. 'string', 'integer', 'big_decimal', 'uuid').","For custom types, register them via a TypeContributor / SupportedTypeContributor on the ServiceRegistry before this mapping is processed, or omit type and let Hibernate infer it.","Check the Hibernate version's list of built-in basic type names if migrating old mappings."],"exampleFix":"<!-- before: 'monny' is not a registered type name -->\n<return-scalar column=\"TOTAL\" type=\"monny\"/>\n\n<!-- after -->\n<return-scalar column=\"TOTAL\" type=\"big_decimal\"/>","handlingStrategy":"validation","validationCode":"// verify the type name against the registry before bootstrapping the mapping:\nboolean known = bootstrapMetadata.getTypeConfiguration()\n        .getBasicTypeRegistry()\n        .getRegisteredType( hibernateTypeName ) != null;\nif ( hibernateTypeName != null && !known ) {\n    throw new IllegalStateException( \"Unknown basic type name in mapping: \" + hibernateTypeName );\n}","typeGuard":null,"tryCatchPattern":"catch ( IllegalArgumentException e ) {\n    if ( e.getMessage().startsWith( \"Could not resolve named type\" ) ) {\n        // replace the type attribute with a registered basic type name, or contribute the custom type first\n    }\n}","preventionTips":["Use canonical Hibernate basic type names ('string', 'integer', ...) in return-scalar type attributes.","Register custom basic types via TypeContributor before the mapping is parsed, in the same bootstrap.","When upgrading Hibernate majors, re-check type names — several were renamed under the 6.x type registry."],"tags":["hibernate","hbm-xml","native-query","type-resolution","scalar"],"backgroundTag":"unknown-type-name","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}