hibernate/hibernate-orm · error · AnnotationException

Collection '<path>' has a '@<annotationSimpleName>' for an u

Error message

Collection '<path>' has a '@<annotationSimpleName>' for an undefined filter named '<name>'

What it means

Error "Collection '<path>' has a '@<annotationSimpleName>' for an undefined filter named '<name>'" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java:1883

	private String getFilterConditionForJoinTable(FilterJoinTable filterJoinTableAnnotation) {
		final String condition = filterJoinTableAnnotation.condition();
		return condition.isBlank()
				? getDefaultFilterCondition( filterJoinTableAnnotation.name(), filterJoinTableAnnotation )
				: condition;
	}

	private String getFilterCondition(Filter filter) {
		final String condition = filter.condition();
		return condition.isBlank()
				? getDefaultFilterCondition( filter.name(), filter )
				: condition;
	}

	private String getDefaultFilterCondition(String name, Annotation annotation) {
		final var definition = getMetadataCollector().getFilterDefinition( name );
		if ( definition == null ) {
			throw new AnnotationException( "Collection '" + qualify( propertyHolder.getPath(), propertyName )
					+ "' has a '@" + annotation.annotationType().getSimpleName()
					+ "' for an undefined filter named '" + name + "'" );
		}
		final String defaultCondition = definition.getDefaultFilterCondition();
		if ( isBlank( defaultCondition ) ) {
			throw new AnnotationException( "Collection '" + qualify( propertyHolder.getPath(), propertyName ) +
					"' has a '@"  + annotation.annotationType().getSimpleName()
					+ "' with no 'condition' and no default condition was given by the '@FilterDef' named '"
					+ name + "'" );
		}
		return defaultCondition;
	}

	private void setCache(Cache cache) {
		if ( cache != null ) {
			cacheRegionName = nullIfEmpty( cache.region() );
			cacheConcurrencyStrategy = EntityBinder.getCacheConcurrencyStrategy( cache.usage() );
		}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Define the filter with @FilterDef using the referenced name, or correct the filter name in the annotation.

When it happens

Trigger: A @Filter/@FilterJoinTable usage references an undefined filter or has no usable condition.

Common situations: @Filter used without a matching @FilterDef, a misspelled filter name, or neither the usage nor the FilterDef supplying a default condition.


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