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 the
MultiTenantConnectionProvider
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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetDatabaseConnectionInfo
(Dialect dialect) void
injectServices
(ServiceRegistryImplementor serviceRegistry) Callback to inject the registry.protected DataSource
protected DataSource
selectDataSource
(T tenantIdentifier) void
stop()
Stop phase notificationMethods inherited from class org.hibernate.engine.jdbc.connections.spi.AbstractDataSourceBasedMultiTenantConnectionProviderImpl
getAnyConnection, getConnection, isUnwrappableAs, releaseAnyConnection, releaseConnection, supportsAggressiveRelease, unwrap
-
Constructor Details
-
DataSourceBasedMultiTenantConnectionProviderImpl
public DataSourceBasedMultiTenantConnectionProviderImpl()
-
-
Method Details
-
selectAnyDataSource
- Specified by:
selectAnyDataSource
in classAbstractDataSourceBasedMultiTenantConnectionProviderImpl<T>
-
selectDataSource
- Specified by:
selectDataSource
in classAbstractDataSourceBasedMultiTenantConnectionProviderImpl<T>
-
injectServices
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
- Specified by:
getDatabaseConnectionInfo
in interfaceMultiTenantConnectionProvider<T>
-