hibernate/hibernate-orm · error · AnnotationException

Embeddable class '<componentClassName>' has an unowned @OneT

Error message

Embeddable class '<componentClassName>' has an unowned @OneToOne property <propertyName>mapped to a join table which is unsupported

What it means

Error "Embeddable class '<componentClassName>' has an unowned @OneToOne property <propertyName>mapped to a join table which is unsupported" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/ComponentPropertyHolder.java:364

		return component.getTable();
	}

	@Override
	public void addProperty(Property prop, MemberDetails attributeMemberDetails, ClassDetails declaringClass) {
		handleGenericComponentProperty( prop, attributeMemberDetails, getContext() );
		if ( declaringClass != null ) {
			final var inheritanceState = inheritanceStatePerClass.get( declaringClass );
			if ( inheritanceState != null && inheritanceState.isEmbeddableSuperclass() ) {
				addPropertyToMappedSuperclass( prop, attributeMemberDetails, declaringClass, getContext() );
			}
		}
		component.addProperty( prop, declaringClass );
	}

	@Override
	public void movePropertyToJoin(Property prop, Join join, MemberDetails memberDetails, ClassDetails declaringClass) {
		// or maybe only throw if component.getTable() != join.getTable()
		throw new AnnotationException(
				"Embeddable class '" + component.getComponentClassName()
				+ "' has an unowned @OneToOne property " + prop.getName()
				+ "mapped to a join table which is unsupported"
		);
	}

	@Override
	public KeyValue getIdentifier() {
		return component.getOwner().getIdentifier();
	}

	@Override
	public boolean isOrWithinEmbeddedId() {
		return isOrWithinEmbeddedId;
	}

	@Override
	public boolean isWithinElementCollection() {

View on GitHub (pinned to fad1729dce)

Solutions

  1. Make the @OneToOne in the embeddable the owning side without a join table, or move it out of the embeddable class.

When it happens

Trigger: An @Embeddable / @Embedded / @ElementCollection mapping violates an embeddable mapping constraint.

Common situations: Embeddables with @Id members, inheritance, recursive composition, or properties split across multiple tables; or @Convert/@EmbeddedTable placed where unsupported.


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