hibernate/hibernate-orm · error · AnnotationException

Collection '<path>' has a '@<annotationSimpleName>' with no

Error message

Collection '<path>' has a '@<annotationSimpleName>' with no 'condition' and no default condition was given by the '@FilterDef' named '<name>'

What it means

Error "Collection '<path>' has a '@<annotationSimpleName>' with no 'condition' and no default condition was given by the '@FilterDef' named '<name>'" thrown in hibernate/hibernate-orm.

Source

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

	}

	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() );
		}
		else {
			cacheConcurrencyStrategy = null;
			cacheRegionName = null;
		}
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Add an explicit condition to the filter annotation, or give the @FilterDef a defaultCondition.

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/7740bcc6afac5d3f. Report an issue: GitHub.