hibernate/hibernate-orm · error · IllegalArgumentException

StatementInspector cannot be null

Error message

StatementInspector cannot be null

What it means

Error "StatementInspector cannot be null" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/internal/JdbcSessionContextImpl.java:51

			SessionFactoryImplementor sessionFactory,
			StatementObserver statementObserver,
			StatementInspector statementInspector,
			PhysicalConnectionHandlingMode connectionHandlingMode,
			JdbcServices jdbcServices,
			BatchBuilder batchBuilder,
			JdbcEventHandler jdbcEventHandler) {
		this.sessionFactory = sessionFactory;
		this.statementObserver = statementObserver != null
				? statementObserver
				: sessionFactory.getStatementObserver();
		this.statementInspector = statementInspector;
		this.connectionHandlingMode = connectionHandlingMode;
		this.jdbcServices = jdbcServices;
		this.batchBuilder = batchBuilder;
		this.jdbcEventHandler = jdbcEventHandler;

		if ( statementInspector == null ) {
			throw new IllegalArgumentException( "StatementInspector cannot be null" );
		}
	}

	@Override
	public boolean isScrollableResultSetsEnabled() {
		return settings().isScrollableResultSetsEnabled();
	}

	@Override
	public boolean isGetGeneratedKeysEnabled() {
		return settings().isGetGeneratedKeysEnabled();
	}

	@Override
	public Integer getFetchSizeOrNull() {
		return settings().getJdbcFetchSize();
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Do not set a null StatementInspector; omit the call or pass a valid inspector.

When it happens

Trigger: Thrown when a caller passes a null StatementInspector to the API guarded in JdbcSessionContextImpl.java:51.

Common situations: Typical situations: calling the method with an uninitialized variable; a lookup that returned null being passed straight through; missing null-checks in application code before invoking Hibernate.


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