Interface DataSourceSupplier
-
- All Known Implementing Classes:
MultiTenantDbCatalogSupplier
public interface DataSourceSupplier
Supply the DataSource to the transaction manager.Implementations can support multi-tenancy via DB or SCHEMA.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Connection
getConnection(Object tenantId)
Return a connection from the DataSource taking into account a tenantId for multi-tenant lazy loading.DataSource
getDataSource()
Return the DataSource to use for the current request.Connection
getReadOnlyConnection(Object tenantId)
Return a connection from the read only DataSource taking into account a tenantId for multi-tenant lazy loading.DataSource
getReadOnlyDataSource()
Return the read only DataSource to use for the current request.void
shutdown(boolean deregisterDriver)
Shutdown the datasource de-registering the JDBC driver if requested.
-
-
-
Method Detail
-
getDataSource
DataSource getDataSource()
Return the DataSource to use for the current request.This should take into account multi-tenancy and the current tenantId.
-
getReadOnlyDataSource
DataSource getReadOnlyDataSource()
Return the read only DataSource to use for the current request.This can return null meaning that no read only DataSource (with autoCommit) is available for use so normal transactions with explicit commit should be used.
-
getConnection
Connection getConnection(Object tenantId) throws SQLException
Return a connection from the DataSource taking into account a tenantId for multi-tenant lazy loading.- Parameters:
tenantId
- Most often null but well supplied indicates a multi-tenant lazy loading query- Returns:
- the connection to use
- Throws:
SQLException
-
getReadOnlyConnection
Connection getReadOnlyConnection(Object tenantId) throws SQLException
Return a connection from the read only DataSource taking into account a tenantId for multi-tenant lazy loading.- Parameters:
tenantId
- Most often null but well supplied indicates a multi-tenant lazy loading query- Returns:
- the connection to use
- Throws:
SQLException
-
shutdown
void shutdown(boolean deregisterDriver)
Shutdown the datasource de-registering the JDBC driver if requested.
-
-