@Override public Connection getAnyConnection() throws SQLException { return selectAnyDataSource().getConnection(); }
@Override public Connection getConnection(String tenantIdentifier) throws SQLException { return selectDataSource( tenantIdentifier ).getConnection(); }
@Override public Connection getConnection(String tenantIdentifier) throws SQLException { String tenant = getTenant(); if (tenant == null) tenant = tenantIdentifier; Connection conn = super.getConnection(tenant); logger.debug("Tenant schema:" + tenant); conn.setSchema(tenant); return conn; }
@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 ); } } }
@Override public Connection getConnection(String tenantIdentifier) throws SQLException { return selectDataSource( tenantIdentifier ).getConnection(); }
@Override public Connection getAnyConnection() throws SQLException { return selectAnyDataSource().getConnection(); }
@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 ); } } }