hibernate/hibernate-orm · error · UnsupportedOperationException

The application must supply JDBC connections

Error message

The application must supply JDBC connections

What it means

UserSuppliedConnectionProviderImpl is a stub used when the application must hand connections to the session directly; calling getConnection() on it is unsupported by design. Sentinel UnsupportedOperationException, not a runtime failure.

Solutions

  1. Supply JDBC connections programmatically via the ConnectionProvider passed to the SessionFactory
  2. Configure a real ConnectionProvider (driver manager or datasource) instead of the user-supplied one
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/UserSuppliedConnectionProviderImpl.java:40 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/6022fae9cea0f494. Report an issue: GitHub.

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/UserSuppliedConnectionProviderImpl.java:40

public class UserSuppliedConnectionProviderImpl implements ConnectionProvider {
	@Override
	public boolean isUnwrappableAs(@Nonnull Class<?> unwrapType) {
		return unwrapType.isAssignableFrom( UserSuppliedConnectionProviderImpl.class );
	}

	@Override
	public <T> T unwrap(@Nonnull Class<T> unwrapType) {
		if ( unwrapType.isAssignableFrom( UserSuppliedConnectionProviderImpl.class ) ) {
			return unwrapType.cast( this );
		}
		else {
			throw new UnknownUnwrapTypeException( unwrapType );
		}
	}

	@Override
	public Connection getConnection() throws SQLException {
		throw new UnsupportedOperationException( "The application must supply JDBC connections" );
	}

	@Override
	public void closeConnection(Connection connection) throws SQLException {
		throw new UnsupportedOperationException( "The application must supply JDBC connections" );
	}

	@Override
	public boolean supportsAggressiveRelease() {
		return false;
	}
}

View on GitHub (pinned to fad1729dce)