{"record":{"id":"73fef3cd3262ecb2","repo":"hibernate/hibernate-orm","slug":"oops-we-are-missing-something","errorCode":null,"errorMessage":"oops, we are missing something: {}","messagePattern":"oops, we are missing something: (.+?)","errorType":"exception","errorClass":"UnsupportedMappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/metamodel/internal/AttributeFactory.java","lineNumber":506,"sourceCode":"\t\t\t// component\n\t\t\treturn new SingularAttributeMetadataImpl<>(\n\t\t\t\t\tpropertyMapping,\n\t\t\t\t\tattributeContext.getOwnerType(),\n\t\t\t\t\tmember,\n\t\t\t\t\tAttributeClassification.EMBEDDED\n\t\t\t);\n\t\t}\n\t\telse {\n\t\t\tassert type instanceof BasicType<?>;\n\t\t\t// basic type\n\t\t\treturn new SingularAttributeMetadataImpl<>(\n\t\t\t\t\tpropertyMapping,\n\t\t\t\t\tattributeContext.getOwnerType(),\n\t\t\t\t\tmember,\n\t\t\t\t\tAttributeClassification.BASIC\n\t\t\t);\n\t\t}\n\t\tthrow new UnsupportedMappingException( \"oops, we are missing something: \" + propertyMapping );\n\t}\n\n\tprivate static AttributeClassification indexClassification(Value value) {\n\t\tif ( value instanceof Map map ) {\n\t\t\treturn keyClassification( map.getIndex().getType() );\n\t\t}\n\t\telse if ( value instanceof List ) {\n\t\t\treturn AttributeClassification.BASIC;\n\t\t}\n\t\telse {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tprivate static AttributeClassification elementClassification(\n\t\t\torg.hibernate.type.Type elementType, boolean isManyToMany) {\n\t\t// First, determine the type of the elements and use that to help determine the\n\t\t// collection type","sourceCodeStart":488,"sourceCodeEnd":524,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AttributeFactory.java#L488-L524","documentation":"AttributeFactory builds JPA metamodel attributes and classifies each persistent property type as entity, embeddable, or basic. This UnsupportedMappingException (\"oops, we are missing something\") is the fall-through guard after those branches: in stock Hibernate it is effectively unreachable, because the preceding if/else-if/else returns for every case. Seeing it means the property's Type fell into none of the handled classifications — practically only possible with exotic custom types or a Hibernate bug.","triggerScenarios":"Calling EntityManagerFactory.getMetamodel() / CriteriaBuilder over an entity whose property uses a custom UserType/BasicType that does not register as BasicType and is neither an entity nor a component; running an older/weakened Hibernate build where the classification branches were modified; edge-case types introduced by custom integrations (soft-delete wrappers, tenant types, etc.).","commonSituations":"Third-party or in-house BasicType/UserType implementations that do not implement BasicType but also are not Component/Entity types; Hibernate version upgrades where AttributeFactory classification logic changed; exotic mapping of arrays/collections classified oddly before being passed to the metamodel.","solutions":["Inspect the property named in the message (propertyMapping) and check its custom type; the fastest workaround is mapping that property with a standard BasicType or @Type(basic).","Upgrade to the latest patch release of your Hibernate line — this guard has had classification bugs fixed over time.","If it reproduces on current Hibernate with a minimal entity, report it with a test case at Hibernate JIRA; the branch should be unreachable.","As a diagnostic, dump the Hibernate Type for the property ( sessionFactory.getMetamodel() ... or MappingMetamodelImpl.findTypeDescriptor) to see what it actually resolves to."],"exampleFix":"// before — custom wrapper type confuses metamodel classification\n@Type(value = MyWeirdType.class)\nprivate Money price;\n\n// after — map as a normal basic type (converter or standard type)\n@Convert(converter = MoneyConverter.class)\nprivate Money price;","handlingStrategy":"fallback","validationCode":"// smoke-test metamodel construction for all entities at startup\nEntityManagerFactory emf = Persistence.createEntityManagerFactory(\"pu\");\nemf.getMetamodel().getEntities().forEach(e -> e.getAttributes().forEach(a -> a.getJavaType()));","typeGuard":null,"tryCatchPattern":"try {\n    emf.getMetamodel().getManagedTypes();\n} catch (UnsupportedMappingException e) {\n    if (e.getMessage().startsWith(\"oops, we are missing something\")) {\n        // property type unsupported by metamodel classification — replace custom type or upgrade Hibernate\n    }\n    throw e;\n}","preventionTips":["Exercise getMetamodel() for every entity in a CI smoke test.","Prefer standard BasicTypes/@Convert over exotic custom types for metamodel-visible attributes.","Keep Hibernate updated — classification gaps that reach this guard are bug territory."],"tags":["hibernate","jpa-metamodel","custom-type","internal-error"],"backgroundTag":"unsupported-mapping-type","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}