Package org.hibernate.reactive.pool.impl
Class SqlClientPool
java.lang.Object
org.hibernate.reactive.pool.impl.SqlClientPool
- All Implemented Interfaces:
Serializable,ReactiveConnectionPool,org.hibernate.service.Service
- Direct Known Subclasses:
DefaultSqlClientPool,ExternalSqlClientPool
A pool of reactive connections backed by a supplier of
Vert.x
Pool instances.
The Vert.x notion of pool is not to be confused with the traditional JDBC notion of a connection pool: there is a fundamental difference as the Vert.x pool should not be shared across threads or with other Vert.x contexts.
Therefore, the reactive SessionFactory doesn't
retain a single instance of Pool, but rather has
a supplier which produces a new Pool within each
context.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionObtain a reactive connection, returning the connection via aCompletionStage.getConnection(String tenantId) Obtain a reactive connection for the given tenant id, returning the connection via aCompletionStage.getConnection(String tenantId, org.hibernate.engine.jdbc.spi.SqlExceptionHelper sqlExceptionHelper) Obtain a reactive connection for the given tenant id, returning the connection via aCompletionStageand overriding the defaultSqlExceptionHelperfor the pool.getConnection(org.hibernate.engine.jdbc.spi.SqlExceptionHelper sqlExceptionHelper) Obtain a reactive connection, returning the connection via aCompletionStageand overriding the defaultSqlExceptionHelperfor the pool.protected abstract io.vertx.sqlclient.PoolgetPool()protected abstract org.hibernate.engine.jdbc.spi.SqlExceptionHelperprotected abstract org.hibernate.engine.jdbc.spi.SqlStatementLoggerprotected io.vertx.sqlclient.PoolgetTenantPool(String tenantId) Get aPoolfor the specified tenant.selectJdbcOutsideTransaction(String sql, Object[] paramValues) This method is intended to be used only for queries returning a ResultSet that must be executed outside any "current" transaction (i.e.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.reactive.pool.ReactiveConnectionPool
getCloseFuture
-
Constructor Details
-
SqlClientPool
public SqlClientPool()
-
-
Method Details
-
getPool
protected abstract io.vertx.sqlclient.Pool getPool()- Returns:
- the underlying Vert.x
Poolfor the current context.
-
getSqlStatementLogger
protected abstract org.hibernate.engine.jdbc.spi.SqlStatementLogger getSqlStatementLogger()- Returns:
- a Hibernate
SqlStatementLoggerfor logging SQL statements as they are executed
-
getSqlExceptionHelper
protected abstract org.hibernate.engine.jdbc.spi.SqlExceptionHelper getSqlExceptionHelper()- Returns:
- a Hibernate
SqlExceptionHelperfor converting exceptions
-
getTenantPool
Get aPoolfor the specified tenant.This is an unimplemented operation which must be overridden by subclasses which support multitenancy.
- Parameters:
tenantId- the id of the tenant- Throws:
UnsupportedOperationException- if multitenancy is not supported- See Also:
-
getConnection
Description copied from interface:ReactiveConnectionPoolObtain a reactive connection, returning the connection via aCompletionStage.- Specified by:
getConnectionin interfaceReactiveConnectionPool
-
getConnection
public CompletionStage<ReactiveConnection> getConnection(org.hibernate.engine.jdbc.spi.SqlExceptionHelper sqlExceptionHelper) Description copied from interface:ReactiveConnectionPoolObtain a reactive connection, returning the connection via aCompletionStageand overriding the defaultSqlExceptionHelperfor the pool.- Specified by:
getConnectionin interfaceReactiveConnectionPool
-
getConnection
Description copied from interface:ReactiveConnectionPoolObtain a reactive connection for the given tenant id, returning the connection via aCompletionStage.- Specified by:
getConnectionin interfaceReactiveConnectionPool
-
getConnection
public CompletionStage<ReactiveConnection> getConnection(String tenantId, org.hibernate.engine.jdbc.spi.SqlExceptionHelper sqlExceptionHelper) Description copied from interface:ReactiveConnectionPoolObtain a reactive connection for the given tenant id, returning the connection via aCompletionStageand overriding the defaultSqlExceptionHelperfor the pool.- Specified by:
getConnectionin interfaceReactiveConnectionPool
-
selectJdbcOutsideTransaction
This method is intended to be used only for queries returning a ResultSet that must be executed outside any "current" transaction (i.e. with autocommit=true). For example, it would be appropriate to use this method when performing queries on information_schema or system tables in order to obtain metadata information about catalogs, schemas, tables, etc.- Specified by:
selectJdbcOutsideTransactionin interfaceReactiveConnectionPool- Parameters:
sql- - the query to execute outside a transactionparamValues- - a non-null array of parameter values- Returns:
- the CompletionStage
from executing the query.
-