hibernate/hibernate-orm · error · IllegalArgumentException

Null keys

Error message

Null keys

What it means

Error "Null keys" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/internal/find/AbstractFindMultipleByKeyOperation.java:173

					this.enabledFetchProfile( enabledFetchProfile.profileName() );
				}
				else if ( option instanceof NaturalIdSynchronization naturalIdSynchronization ) {
					this.naturalIdSynchronization = naturalIdSynchronization;
				}
			}
		}
	}

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

	protected void checkKeys(List<?> keys) {
		if ( keys == null ) {
			throw new IllegalArgumentException( "Null keys" );
		}
		for ( Object key : keys ) {
			if ( key == null ) {
				throw new IllegalArgumentException( "Null key" );
			}
		}
	}

	protected void checkFindRequirements(List<?> keys, SharedSessionContractImplementor session) {
		checkKeys( keys );
		checkTransactionNeededForLock( session, getLockMode() );
	}

	public List<T> performFind(
			List<?> keys,
			@Nullable GraphSemantic graphSemantic,
			@Nullable RootGraphImplementor<T> rootGraph) {
		final var session = getSession();

View on GitHub (pinned to fad1729dce)

Solutions

  1. Filter out null keys before calling findMultiple; validate the key collection first.

When it happens

Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/internal/find/AbstractFindMultipleByKeyOperation.java:173 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/8ad0fbb6e7d00fd2. Report an issue: GitHub.