hibernate/hibernate-orm · error · AnnotationException

Entity '${name}' has a '@Filter' with no 'condition' and no

Error message

Entity '${name}' has a '@Filter' with no 'condition' and no default condition was given by the '@FilterDef' named '${filterName}'

What it means

Error "Entity '${name}' has a '@Filter' with no 'condition' and no default condition was given by the '@FilterDef' named '${filterName}'" thrown in hibernate/hibernate-orm.

Source

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

			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 );
			}
		}
	}

	private String toPhysicalName(String logicalName) {

View on GitHub (pinned to fad1729dce)

Solutions

  1. Add a condition to the @Filter, or set a defaultCondition on the referenced @FilterDef.

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