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 theMultiTenantConnectionProvider
contract bases on a number of reasonable assumptions. We assume that:-
The
DataSource
instances 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_KEY
must 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 DatabaseConnectionInfo
getDatabaseConnectionInfo(Dialect dialect)
void
injectServices(ServiceRegistryImplementor serviceRegistry)
Callback to inject the registry.protected DataSource
selectAnyDataSource()
protected DataSource
selectDataSource(T tenantIdentifier)
void
stop()
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:
selectAnyDataSource
in classAbstractDataSourceBasedMultiTenantConnectionProviderImpl<T>
-
selectDataSource
protected DataSource selectDataSource(T tenantIdentifier)
- Specified by:
selectDataSource
in classAbstractDataSourceBasedMultiTenantConnectionProviderImpl<T>
-
injectServices
public void injectServices(ServiceRegistryImplementor serviceRegistry)
Description copied from interface:ServiceRegistryAwareService
Callback to inject the registry.- Specified by:
injectServices
in interfaceServiceRegistryAwareService
- Parameters:
serviceRegistry
- The registry
-
stop
public void stop()
Description copied from interface:Stoppable
Stop phase notification
-
getDatabaseConnectionInfo
public DatabaseConnectionInfo getDatabaseConnectionInfo(Dialect dialect)
- Specified by:
getDatabaseConnectionInfo
in interfaceMultiTenantConnectionProvider<T>
-
-