Class DataSourceBasedMultiTenantConnectionProviderImpl<T>
- java.lang.Object
-
- org.hibernate.engine.jdbc.connections.spi.AbstractDataSourceBasedMultiTenantConnectionProviderImpl<T>
-
- org.hibernate.engine.jdbc.connections.spi.DataSourceBasedMultiTenantConnectionProviderImpl<T>
-
- All Implemented Interfaces:
Serializable,MultiTenantConnectionProvider<T>,Service,ServiceRegistryAwareService,Stoppable,Wrapped
public class DataSourceBasedMultiTenantConnectionProviderImpl<T> extends AbstractDataSourceBasedMultiTenantConnectionProviderImpl<T> implements ServiceRegistryAwareService, Stoppable
A concrete implementation of theMultiTenantConnectionProvidercontract bases on a number of reasonable assumptions. We assume that:-
The
DataSourceinstances are all available from JNDI named by the tenant identifier relative to a single base JNDI context -
"hibernate.connection.datasource" is a string naming either the any
data source or the base JNDI context. If the latter,
MultiTenancySettings.TENANT_IDENTIFIER_TO_USE_FOR_ANY_KEYmust also be set.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DataSourceBasedMultiTenantConnectionProviderImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DatabaseConnectionInfogetDatabaseConnectionInfo(Dialect dialect)voidinjectServices(ServiceRegistryImplementor serviceRegistry)Callback to inject the registry.protected DataSourceselectAnyDataSource()protected DataSourceselectDataSource(T tenantIdentifier)voidstop()Stop phase notification-
Methods inherited from class org.hibernate.engine.jdbc.connections.spi.AbstractDataSourceBasedMultiTenantConnectionProviderImpl
getAnyConnection, getConnection, isUnwrappableAs, releaseAnyConnection, releaseConnection, supportsAggressiveRelease, unwrap
-
-
-
-
Method Detail
-
selectAnyDataSource
protected DataSource selectAnyDataSource()
- Specified by:
selectAnyDataSourcein classAbstractDataSourceBasedMultiTenantConnectionProviderImpl<T>
-
selectDataSource
protected DataSource selectDataSource(T tenantIdentifier)
- Specified by:
selectDataSourcein classAbstractDataSourceBasedMultiTenantConnectionProviderImpl<T>
-
injectServices
public void injectServices(ServiceRegistryImplementor serviceRegistry)
Description copied from interface:ServiceRegistryAwareServiceCallback to inject the registry.- Specified by:
injectServicesin interfaceServiceRegistryAwareService- Parameters:
serviceRegistry- The registry
-
stop
public void stop()
Description copied from interface:StoppableStop phase notification
-
getDatabaseConnectionInfo
public DatabaseConnectionInfo getDatabaseConnectionInfo(Dialect dialect)
- Specified by:
getDatabaseConnectionInfoin interfaceMultiTenantConnectionProvider<T>
-
-