hibernate/hibernate-orm · error · AnnotationException

' ' should specify either ' ' or ' ' (was ' ')

Error message

'%s' should specify either '%s' or '%s' (was '%s')

What it means

Setting-interpretation guard for hibernate.mapping.default_list_semantics: the configured value interpreted to a CollectionClassification other than LIST or BAG, the only two legal defaults for list-mapped attributes. The setting string is outside the accepted set.

Solutions

  1. Set exactly one of the two expected configuration properties to the required value; the current value is not recognized.
  2. Check the Hibernate documentation for the allowed values of the named setting.
  3. Remove the setting to use the documented default behavior.
Defensive patterns

Strategy: validation

When it happens

Trigger: A configuration setting accepts only a fixed set of values and got something else.

Common situations: Setting a mis-spelled or out-of-range value for a Hibernate configuration property.


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

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuilderImpl.java:528

			implicitlyQuoteIdentifiers = configService.getSetting(
					GLOBALLY_QUOTED_IDENTIFIERS,
					BOOLEAN,
					false
			);

			implicitCacheAccessType = configService.getSetting(
					DEFAULT_CACHE_CONCURRENCY_STRATEGY,
					value -> AccessType.fromExternalName( value.toString() )
			);

			implicitListClassification = configService.getSetting(
					DEFAULT_LIST_SEMANTICS,
					value -> {
						final var classification = CollectionClassification.interpretSetting( value );
						if ( classification != CollectionClassification.LIST
							&& classification != CollectionClassification.BAG ) {
							throw new AnnotationException(
									String.format(
											Locale.ROOT,
											"'%s' should specify either '%s' or '%s' (was '%s')",
											DEFAULT_LIST_SEMANTICS,
											java.util.List.class.getName(),
											java.util.Collection.class.getName(),
											classification.name()
									)
							);
						}
						return classification;
					},
					CollectionClassification.BAG
			);
		}

		@Override
		public String getImplicitSchemaName() {

View on GitHub (pinned to fad1729dce)