hibernate/hibernate-orm · error · AnnotationException

'AttributeConverter' not allowed for attribute '{}' annotate

Error message

'AttributeConverter' not allowed for attribute '{}' annotated '@{}' (use '@Convert(disableConversion=true)' to suppress this error)

What it means

Error "'AttributeConverter' not allowed for attribute '{}' annotated '@{}' (use '@Convert(disableConversion=true)' to suppress this error)" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/BasicValueBinder.java:1123

			disallowConverter( attribute, ManyToOne.class, autoApply );
			disallowConverter( attribute, OneToOne.class, autoApply );
			disallowConverter( attribute, OneToMany.class, autoApply );
			disallowConverter( attribute, ManyToMany.class, autoApply );
			// Note that @Convert is only allowed in conjunction with
			// @Embedded if it specifies a field using attributeName
			disallowConverter( attribute, Embedded.class, autoApply );
			disallowConverter( attribute, EmbeddedId.class, autoApply );
		}
		// I assume that these do not work with converters (no tests)
		disallowConverter( attribute, Struct.class, autoApply );
		disallowConverter( attribute, Array.class, autoApply );
		disallowConverter( attribute, Any.class, autoApply );
		converterDescriptor = attributeConverterDescriptor;
	}

	void disallowConverter(MemberDetails attribute, Class<? extends Annotation> annotationType, boolean autoApply) {
		if ( attribute.hasDirectAnnotationUsage( annotationType ) ) {
			throw new AnnotationException( "'AttributeConverter' not allowed for attribute '" + attribute.getName()
											+ "' annotated '@" + annotationType.getName() + "'"
											+ ( autoApply ? " (use '@Convert(disableConversion=true)' to suppress this error)" : "" ) );
		}
	}

	public BasicValue make() {
		if ( basicValue != null ) {
			return basicValue;
		}

		columns.checkPropertyConsistency();

		if ( table == null ) {
			table = columns.getTable();
		}

		basicValue = new BasicValue( buildingContext, table );

View on GitHub (pinned to fad1729dce)

Solutions

  1. Remove the AttributeConverter for the attribute, since the other annotation forbids conversion.
  2. Or add @Convert(disableConversion=true) to explicitly suppress conversion for the attribute.

When it happens

Trigger: A @Convert / AttributeConverter declaration is missing required information or applies to a target that forbids conversion.

Common situations: @Convert without attributeName on a class-level or embedded target, or a converter clashing with a mapping annotation like @Enumerated/@Temporal that requires disableConversion=true.


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