hibernate/hibernate-orm · error · AnnotationException

Collection ' ' is an association with no join table and may…

Error message

Collection '<path>' is an association with no join table and may not have a '@FilterJoinTable'

What it means

FilterJoinTable binding guard: addFilterJoinTable was called for a collection without an association table (one-to-many style), so a @FilterJoinTable cannot be applied - there is no join table whose rows the filter would restrict.

Solutions

  1. Remove @FilterJoinTable from the association, since it has no join table.
  2. Or configure a join table for the association if join-table filtering is needed.
Defensive patterns

Strategy: validation

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

Appendix: source

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

		);
		return restrictionOnClass != null ? restrictionOnClass.value() : null;
	}

	private void addFilterJoinTable(boolean hasAssociationTable, FilterJoinTable filter) {
		if ( hasAssociationTable ) {
			final Map<String,String> aliasTableMap = new HashMap<>();
			final Map<String,String> aliasEntityMap = new HashMap<>();
			fillAliasMaps( filter.aliases(), aliasTableMap, aliasEntityMap );
			collection.addFilter(
					filter.name(),
					getFilterConditionForJoinTable( filter ),
					filter.deduceAliasInjectionPoints(),
					aliasTableMap,
					aliasEntityMap
			);
		}
		else {
			throw new AnnotationException( "Collection '" + qualify( propertyHolder.getPath(), propertyName )
					+ "' is an association with no join table and may not have a '@FilterJoinTable'" );
		}
	}

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

View on GitHub (pinned to fad1729dce)