hibernate/hibernate-orm · error · IllegalArgumentException

Option '" + findMultipleOption + "' can only be used in 'fin

Error message

Option '" + findMultipleOption + "' can only be used in 'findMultiple()'

What it means

Error "Option '" + findMultipleOption + "' can only be used in 'findMultiple()'" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/internal/find/AbstractFindByKeyOperation.java:170

				}
				else if ( option instanceof ReadOnlyMode readOnlyMode ) {
					this.readOnlyMode = readOnlyMode;
				}
				else if ( option instanceof EnabledFetchProfile enabledFetchProfile ) {
					this.enabledFetchProfile( enabledFetchProfile.profileName() );
				}
				else if ( option instanceof NaturalIdSynchronization naturalIdSynchronization ) {
					this.naturalIdSynchronization = naturalIdSynchronization;
				}
				else if ( option instanceof GraphSemantic graphSemanticOption ) {
					if ( rootGraph == null ) {
						throw new IllegalArgumentException(
								"GraphSemantic option was specified, but no Graph was supplied" );
					}
					this.graphSemantic = graphSemanticOption;
				}
				else if ( option instanceof FindMultipleOption findMultipleOption ) {
					throw new IllegalArgumentException(
							"Option '" + findMultipleOption + "' can only be used in 'findMultiple()'" );
				}
			}
		}
	}

	private void enabledFetchProfile(String profileName) {
		if ( enabledFetchProfiles == null ) {
			enabledFetchProfiles = new HashSet<>();
		}
		enabledFetchProfiles.add( profileName );
	}

	public EntityPersister getEntityDescriptor() {
		return entityDescriptor;
	}

	public KeyType getKeyType() {

View on GitHub (pinned to fad1729dce)

Solutions

  1. Use the option only with findMultiple(); for single find, remove the findMultiple-only option.

When it happens

Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/internal/find/AbstractFindByKeyOperation.java:170 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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