org.hibernate.service.UnknownUnwrapTypeException Java Examples

The following examples show how to use org.hibernate.service.UnknownUnwrapTypeException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: QuarkusConnectionProvider.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@Override
public <T> T unwrap(final Class<T> unwrapType) {
    if (ConnectionProvider.class.equals(unwrapType) ||
            QuarkusConnectionProvider.class.isAssignableFrom(unwrapType)) {
        return (T) this;
    } else if (DataSource.class.isAssignableFrom(unwrapType) || AgroalDataSource.class.isAssignableFrom(unwrapType)) {
        return (T) dataSource;
    } else {
        throw new UnknownUnwrapTypeException(unwrapType);
    }
}
 
Example #2
Source File: AbstractMultiTenantConnectionProvider.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap(Class<T> unwrapType) {
	if ( MultiTenantConnectionProvider.class.isAssignableFrom( unwrapType ) ) {
		return (T) this;
	}
	else if ( ConnectionProvider.class.isAssignableFrom( unwrapType ) ) {
		return (T) getAnyConnectionProvider();
	}
	else {
		throw new UnknownUnwrapTypeException( unwrapType );
	}
}
 
Example #3
Source File: AbstractDataSourceBasedMultiTenantConnectionProviderImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings( {"unchecked"})
public <T> T unwrap(Class<T> unwrapType) {
	if ( MultiTenantConnectionProvider.class.isAssignableFrom( unwrapType ) ) {
		return (T) this;
	}
	else if ( DataSource.class.isAssignableFrom( unwrapType ) ) {
		return (T) selectAnyDataSource();
	}
	else {
		throw new UnknownUnwrapTypeException( unwrapType );
	}
}
 
Example #4
Source File: DriverManagerConnectionProviderImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings( {"unchecked"})
public <T> T unwrap(Class<T> unwrapType) {
	if ( ConnectionProvider.class.equals( unwrapType ) ||
			DriverManagerConnectionProviderImpl.class.isAssignableFrom( unwrapType ) ) {
		return (T) this;
	}
	else {
		throw new UnknownUnwrapTypeException( unwrapType );
	}
}
 
Example #5
Source File: UserSuppliedConnectionProviderImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings( {"unchecked"})
public <T> T unwrap(Class<T> unwrapType) {
	if ( ConnectionProvider.class.equals( unwrapType ) ||
			UserSuppliedConnectionProviderImpl.class.isAssignableFrom( unwrapType ) ) {
		return (T) this;
	}
	else {
		throw new UnknownUnwrapTypeException( unwrapType );
	}
}
 
Example #6
Source File: DatasourceConnectionProviderImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings( {"unchecked"})
public <T> T unwrap(Class<T> unwrapType) {
	if ( ConnectionProvider.class.equals( unwrapType ) ||
			DatasourceConnectionProviderImpl.class.isAssignableFrom( unwrapType ) ) {
		return (T) this;
	}
	else if ( DataSource.class.isAssignableFrom( unwrapType ) ) {
		return (T) getDataSource();
	}
	else {
		throw new UnknownUnwrapTypeException( unwrapType );
	}
}
 
Example #7
Source File: TransactionalConnectionProvider.java    From hibernate-demos with Apache License 2.0 5 votes vote down vote up
@Override
public <T> T unwrap(Class<T> aClass) {
    if (isUnwrappableAs(aClass)) {
        return (T) this;
    }

    throw new UnknownUnwrapTypeException(aClass);
}