Class DataSourceBasedMultiTenantConnectionProviderImpl
- java.lang.Object
-
- org.hibernate.engine.jdbc.connections.spi.AbstractDataSourceBasedMultiTenantConnectionProviderImpl
-
- org.hibernate.engine.jdbc.connections.spi.DataSourceBasedMultiTenantConnectionProviderImpl
-
- All Implemented Interfaces:
Serializable
,MultiTenantConnectionProvider
,Service
,ServiceRegistryAwareService
,Stoppable
,Wrapped
public class DataSourceBasedMultiTenantConnectionProviderImpl extends AbstractDataSourceBasedMultiTenantConnectionProviderImpl 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
-
-
Field Summary
Fields Modifier and Type Field Description static String
TENANT_IDENTIFIER_TO_USE_FOR_ANY_KEY
Identifies the DataSource name to use forselectAnyDataSource()
handling
-
Constructor Summary
Constructors Constructor Description DataSourceBasedMultiTenantConnectionProviderImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
injectServices(ServiceRegistryImplementor serviceRegistry)
Callback to inject the registry.protected DataSource
selectAnyDataSource()
protected DataSource
selectDataSource(String tenantIdentifier)
void
stop()
Stop phase notification-
Methods inherited from class org.hibernate.engine.jdbc.connections.spi.AbstractDataSourceBasedMultiTenantConnectionProviderImpl
getAnyConnection, getConnection, isUnwrappableAs, releaseAnyConnection, releaseConnection, supportsAggressiveRelease, unwrap
-
-
-
-
Field Detail
-
TENANT_IDENTIFIER_TO_USE_FOR_ANY_KEY
public static final String TENANT_IDENTIFIER_TO_USE_FOR_ANY_KEY
Identifies the DataSource name to use forselectAnyDataSource()
handling- See Also:
- Constant Field Values
-
-
Method Detail
-
selectAnyDataSource
protected DataSource selectAnyDataSource()
- Specified by:
selectAnyDataSource
in classAbstractDataSourceBasedMultiTenantConnectionProviderImpl
-
selectDataSource
protected DataSource selectDataSource(String tenantIdentifier)
- Specified by:
selectDataSource
in classAbstractDataSourceBasedMultiTenantConnectionProviderImpl
-
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
-
-