| AbstractMultiTenantConnectionProvider has a minor bug in the unwrapping code.
@Override
public boolean isUnwrappableAs(Class unwrapType) {
return ConnectionProvider.class.equals( unwrapType ) ||
MultiTenantConnectionProvider.class.equals( unwrapType ) ||
AbstractMultiTenantConnectionProvider.class.isAssignableFrom( unwrapType );
}
@Override
@SuppressWarnings( {"unchecked"})
public <T> T unwrap(Class<T> unwrapType) {
if ( isUnwrappableAs( unwrapType ) ) {
return (T) this;
}
else {
throw new UnknownUnwrapTypeException( unwrapType );
}
}
The unwrap method fails when trying to unwrap to ConnectionProvider. I would suggest removing ConnectionProvider.class.equals( unwrapType ) from isUnwrappableAs, because it is ambiguous which connection provider should be unwrapped (anyConnectionProvider or connectionProvider for tenant (which tenant?)?). |