hibernate/hibernate-orm · error · AnnotationException

Entity '${name}' has a '@Filter' for an undefined filter nam

Error message

Entity '${name}' has a '@Filter' for an undefined filter named '${filterName}'

What it means

Error "Entity '${name}' has a '@Filter' for an undefined filter named '${filterName}'" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java:1626

			final String filterName = filter.name();
			String condition = filter.condition();
			if ( condition.isBlank() ) {
				condition = getDefaultFilterCondition( filterName );
			}
			persistentClass.addFilter(
					filterName,
					condition,
					filter.deduceAliasInjectionPoints(),
					toAliasTableMap( filter.aliases() ),
					toAliasEntityMap( filter.aliases() )
			);
		}
	}

	private String getDefaultFilterCondition(String filterName) {
		final var definition = getMetadataCollector().getFilterDefinition( filterName );
		if ( definition == null ) {
			throw new AnnotationException( "Entity '" + name
					+ "' has a '@Filter' for an undefined filter named '" + filterName + "'" );
		}
		final String condition = definition.getDefaultFilterCondition();
		if ( isBlank( condition ) ) {
			throw new AnnotationException( "Entity '" + name +
					"' has a '@Filter' with no 'condition' and no default condition was given by the '@FilterDef' named '"
					+ filterName + "'" );
		}
		return condition;
	}

	private void bindSynchronize() {
		final var synchronize = annotatedClass.getAnnotationUsage( Synchronize.class, modelsContext() );
		if ( synchronize != null ) {
			final boolean logical = synchronize.logical();
			for ( String tableName : synchronize.value() ) {
				final String physicalName = logical ? toPhysicalName( tableName ) : tableName;
				persistentClass.addSynchronizedTable( physicalName );

View on GitHub (pinned to fad1729dce)

Solutions

  1. Define the filter with @FilterDef under the referenced name, or fix the filter name in @Filter.

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