hibernate/hibernate-orm · error · AnnotationException

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

Error message

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

What it means

Error "'%s' should specify either '%s' or '%s' (was '%s')" thrown in hibernate/hibernate-orm.

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)

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.

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.