Package org.hibernate.reactive.pool
Class BatchingConnection
- java.lang.Object
-
- org.hibernate.reactive.pool.BatchingConnection
-
- All Implemented Interfaces:
ReactiveConnection
public class BatchingConnection extends Object implements ReactiveConnection
AReactiveConnectionthat automatically performs batching of insert, update, and delete statements, relieving the client persister code of the responsibility to manage batching. Actual SQL statements are delegated to a givenReactiveConnectionwhich only supports explicit batching usingupdate(String, List).Note that in Hibernate core, the responsibilities of this class are handled by
JdbcCoordinatorand theBatchinterface. However, the model used there is not easily adaptable to the reactive paradigm.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.hibernate.reactive.pool.ReactiveConnection
ReactiveConnection.Expectation, ReactiveConnection.Result
-
-
Constructor Summary
Constructors Constructor Description BatchingConnection(ReactiveConnection delegate, int batchSize)
-
Method Summary
-
-
-
Constructor Detail
-
BatchingConnection
public BatchingConnection(ReactiveConnection delegate, int batchSize)
-
-
Method Detail
-
getDatabaseMetadata
public io.vertx.sqlclient.spi.DatabaseMetadata getDatabaseMetadata()
- Specified by:
getDatabaseMetadatain interfaceReactiveConnection
-
withBatchSize
public ReactiveConnection withBatchSize(int batchSize)
- Specified by:
withBatchSizein interfaceReactiveConnection
-
executeBatch
public CompletionStage<Void> executeBatch()
- Specified by:
executeBatchin interfaceReactiveConnection
-
update
public CompletionStage<Void> update(String sql, Object[] paramValues, boolean allowBatching, ReactiveConnection.Expectation expectation)
- Specified by:
updatein interfaceReactiveConnection
-
execute
public CompletionStage<Void> execute(String sql)
- Specified by:
executein interfaceReactiveConnection
-
executeUnprepared
public CompletionStage<Void> executeUnprepared(String sql)
Description copied from interface:ReactiveConnectionRun sql as statement (instead of preparedStatement)- Specified by:
executeUnpreparedin interfaceReactiveConnection
-
executeOutsideTransaction
public CompletionStage<Void> executeOutsideTransaction(String sql)
- Specified by:
executeOutsideTransactionin interfaceReactiveConnection
-
update
public CompletionStage<Integer> update(String sql)
- Specified by:
updatein interfaceReactiveConnection
-
update
public CompletionStage<Integer> update(String sql, Object[] paramValues)
- Specified by:
updatein interfaceReactiveConnection
-
update
public CompletionStage<int[]> update(String sql, List<Object[]> paramValues)
- Specified by:
updatein interfaceReactiveConnection
-
insertAndSelectIdentifier
public <T> CompletionStage<T> insertAndSelectIdentifier(String sql, Object[] paramValues, Class<T> idClass, String idColumnName)
- Specified by:
insertAndSelectIdentifierin interfaceReactiveConnection
-
select
public CompletionStage<ReactiveConnection.Result> select(String sql)
- Specified by:
selectin interfaceReactiveConnection
-
select
public CompletionStage<ReactiveConnection.Result> select(String sql, Object[] paramValues)
- Specified by:
selectin interfaceReactiveConnection
-
selectJdbc
public CompletionStage<ResultSet> selectJdbc(String sql, Object[] paramValues)
- Specified by:
selectJdbcin interfaceReactiveConnection
-
selectJdbcOutsideTransaction
public CompletionStage<ResultSet> selectJdbcOutsideTransaction(String sql, Object[] paramValues)
Description copied from interface:ReactiveConnectionThis method is intended to be used only for queries returning a ResultSet that must be executed outside of 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 interfaceReactiveConnection- Parameters:
sql- - the query to execute outside of a transactionparamValues- - a non-null array of parameter values- Returns:
- the CompletionStage
from executing the query.
-
selectIdentifier
public <T> CompletionStage<T> selectIdentifier(String sql, Object[] paramValues, Class<T> idClass)
- Specified by:
selectIdentifierin interfaceReactiveConnection
-
beginTransaction
public CompletionStage<Void> beginTransaction()
- Specified by:
beginTransactionin interfaceReactiveConnection
-
commitTransaction
public CompletionStage<Void> commitTransaction()
- Specified by:
commitTransactionin interfaceReactiveConnection
-
rollbackTransaction
public CompletionStage<Void> rollbackTransaction()
- Specified by:
rollbackTransactionin interfaceReactiveConnection
-
close
public CompletionStage<Void> close()
- Specified by:
closein interfaceReactiveConnection
-
-