hibernate/hibernate-orm · error · UnknownUnwrapTypeException
Cannot unwrap to requested type [{}]
Error message
Cannot unwrap to requested type [{}] What it means
Error "Cannot unwrap to requested type [{}]" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/spi/AbstractDataSourceBasedMultiTenantConnectionProviderImpl.java:64
return true;
}
@Override
public boolean isUnwrappableAs(@Nonnull Class<?> unwrapType) {
return unwrapType.isInstance( this )
|| unwrapType.isAssignableFrom( DataSource.class );
}
@Override
public <X> X unwrap(@Nonnull Class<X> unwrapType) {
if ( unwrapType.isInstance( this ) ) {
return unwrapType.cast( this );
}
else if ( unwrapType.isAssignableFrom( DataSource.class ) ) {
return unwrapType.cast( selectAnyDataSource() );
}
else {
throw new UnknownUnwrapTypeException( unwrapType );
}
}
}
View on GitHub (pinned to fad1729dce)
Solutions
- Only unwrap to types implemented by the abstract multi-tenant provider
- Avoid unwrap() to unrelated types
When it happens
Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/spi/AbstractDataSourceBasedMultiTenantConnectionProviderImpl.java:64 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/20cdc3f2e8174c50.
Report an issue: GitHub.