接口 MultiTenantConnectionProvider
-
- 所有超级接口:
Serializable,Service,Wrapped
- 所有已知实现类:
AbstractDataSourceBasedMultiTenantConnectionProviderImpl,AbstractMultiTenantConnectionProvider,DataSourceBasedMultiTenantConnectionProviderImpl
public interface MultiTenantConnectionProvider extends Service, Wrapped
A specialized Connection provider contract used when the application is using multi-tenancy support requiring tenant aware connections.- 作者:
- Steve Ebersole
-
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 ConnectiongetAnyConnection()Allows access to the database metadata of the underlying database(s) in situations where we do not have a tenant id (like startup processing, for example).ConnectiongetConnection(String tenantIdentifier)Obtains a connection for Hibernate use according to the underlying strategy of this provider.voidreleaseAnyConnection(Connection connection)Release a connection obtained fromgetAnyConnection()voidreleaseConnection(String tenantIdentifier, Connection connection)Release a connection from Hibernate use.booleansupportsAggressiveRelease()Does this connection provider support aggressive release of JDBC connections and re-acquisition of those connections (if need be) later?-
从接口继承的方法 org.hibernate.service.spi.Wrapped
isUnwrappableAs, unwrap
-
-
-
-
方法详细资料
-
getAnyConnection
Connection getAnyConnection() throws SQLException
Allows access to the database metadata of the underlying database(s) in situations where we do not have a tenant id (like startup processing, for example).- 返回:
- The database metadata.
- 抛出:
SQLException- Indicates a problem opening a connection
-
releaseAnyConnection
void releaseAnyConnection(Connection connection) throws SQLException
Release a connection obtained fromgetAnyConnection()- 参数:
connection- The JDBC connection to release- 抛出:
SQLException- Indicates a problem closing the connection
-
getConnection
Connection getConnection(String tenantIdentifier) throws SQLException
Obtains a connection for Hibernate use according to the underlying strategy of this provider.- 参数:
tenantIdentifier- The identifier of the tenant for which to get a connection- 返回:
- The obtained JDBC connection
- 抛出:
SQLException- Indicates a problem opening a connectionHibernateException- Indicates a problem otherwise obtaining a connection.
-
releaseConnection
void releaseConnection(String tenantIdentifier, Connection connection) throws SQLException
Release a connection from Hibernate use.- 参数:
connection- The JDBC connection to releasetenantIdentifier- The identifier of the tenant.- 抛出:
SQLException- Indicates a problem closing the connectionHibernateException- Indicates a problem otherwise releasing a connection.
-
supportsAggressiveRelease
boolean supportsAggressiveRelease()
Does this connection provider support aggressive release of JDBC connections and re-acquisition of those connections (if need be) later? This is used in conjunction withAvailableSettings.RELEASE_CONNECTIONSto aggressively release JDBC connections. However, the configured ConnectionProvider must support re-acquisition of the same underlying connection for that semantic to work. Typically, this is only true in managed environments where a container tracks connections by transaction or thread. Note that JTA semantic depends on the fact that the underlying connection provider does support aggressive release.- 返回:
trueif aggressive releasing is supported;falseotherwise.
-
-