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
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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetDatabaseConnectionInfo(Dialect dialect) voidinjectServices(ServiceRegistryImplementor serviceRegistry) Callback to inject the registry.protected DataSourceprotected DataSourceselectDataSource(T tenantIdentifier) voidstop()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:
selectAnyDataSourcein classAbstractDataSourceBasedMultiTenantConnectionProviderImpl<T>
-
selectDataSource
- Specified by:
selectDataSourcein classAbstractDataSourceBasedMultiTenantConnectionProviderImpl<T>
-
injectServices
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
- Specified by:
getDatabaseConnectionInfoin interfaceMultiTenantConnectionProvider<T>
-