接口 ConnectionProvider
-
- 所有超级接口:
Serializable,Service,Wrapped
- 所有已知实现类:
DatasourceConnectionProviderImpl,DriverManagerConnectionProviderImpl,HikariCPConnectionProvider,UserSuppliedConnectionProviderImpl
public interface ConnectionProvider extends Service, Wrapped
A contract for obtaining JDBC connections. Implementors might also implement connection pooling. Implementors should provide a public default constructor.- 作者:
- Gavin King, Steve Ebersole
-
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 voidcloseConnection(Connection conn)Release a connection from Hibernate use.ConnectiongetConnection()Obtains a connection for Hibernate use according to the underlying strategy of this provider.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
-
-
-
-
方法详细资料
-
getConnection
Connection getConnection() throws SQLException
Obtains a connection for Hibernate use according to the underlying strategy of this provider.- 返回:
- The obtained JDBC connection
- 抛出:
SQLException- Indicates a problem opening a connectionHibernateException- Indicates a problem otherwise obtaining a connection.
-
closeConnection
void closeConnection(Connection conn) throws SQLException
Release a connection from Hibernate use.- 参数:
conn- The JDBC connection to release- 抛出:
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.
-
-