hibernate/hibernate-orm · error · UnsupportedMappingException

oops, we are missing something: {}

Error message

oops, we are missing something: {}

What it means

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.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/metamodel/internal/AttributeFactory.java:506

			// component
			return new SingularAttributeMetadataImpl<>(
					propertyMapping,
					attributeContext.getOwnerType(),
					member,
					AttributeClassification.EMBEDDED
			);
		}
		else {
			assert type instanceof BasicType<?>;
			// basic type
			return new SingularAttributeMetadataImpl<>(
					propertyMapping,
					attributeContext.getOwnerType(),
					member,
					AttributeClassification.BASIC
			);
		}
		throw new UnsupportedMappingException( "oops, we are missing something: " + propertyMapping );
	}

	private static AttributeClassification indexClassification(Value value) {
		if ( value instanceof Map map ) {
			return keyClassification( map.getIndex().getType() );
		}
		else if ( value instanceof List ) {
			return AttributeClassification.BASIC;
		}
		else {
			return null;
		}
	}

	private static AttributeClassification elementClassification(
			org.hibernate.type.Type elementType, boolean isManyToMany) {
		// First, determine the type of the elements and use that to help determine the
		// collection type

View on GitHub (pinned to fad1729dce)

Solutions

  1. 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).
  2. Upgrade to the latest patch release of your Hibernate line — this guard has had classification bugs fixed over time.
  3. If it reproduces on current Hibernate with a minimal entity, report it with a test case at Hibernate JIRA; the branch should be unreachable.
  4. As a diagnostic, dump the Hibernate Type for the property ( sessionFactory.getMetamodel() ... or MappingMetamodelImpl.findTypeDescriptor) to see what it actually resolves to.

Example fix

// before — custom wrapper type confuses metamodel classification
@Type(value = MyWeirdType.class)
private Money price;

// after — map as a normal basic type (converter or standard type)
@Convert(converter = MoneyConverter.class)
private Money price;
Defensive patterns

Strategy: fallback

Validate before calling

// smoke-test metamodel construction for all entities at startup
EntityManagerFactory emf = Persistence.createEntityManagerFactory("pu");
emf.getMetamodel().getEntities().forEach(e -> e.getAttributes().forEach(a -> a.getJavaType()));

Try / catch

try {
    emf.getMetamodel().getManagedTypes();
} catch (UnsupportedMappingException e) {
    if (e.getMessage().startsWith("oops, we are missing something")) {
        // property type unsupported by metamodel classification — replace custom type or upgrade Hibernate
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.).

Common situations: 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.

Related errors


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/73fef3cd3262ecb2. Report an issue: GitHub.