public class BatchingConnection extends Object implements ReactiveConnection
ReactiveConnection
that 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 given ReactiveConnection
which only supports explicit batching using update(String, List)
.
Note that in Hibernate core, the responsibilities of this class
are handled by JdbcCoordinator
and the Batch
interface.
However, the model used there is not easily adaptable to the reactive
paradigm.
ReactiveConnection.Expectation, ReactiveConnection.Result
Constructor and Description |
---|
BatchingConnection(ReactiveConnection delegate,
int batchSize) |
public BatchingConnection(ReactiveConnection delegate, int batchSize)
public ReactiveConnection withBatchSize(int batchSize)
withBatchSize
in interface ReactiveConnection
public CompletionStage<Void> executeBatch()
executeBatch
in interface ReactiveConnection
public CompletionStage<Void> update(String sql, Object[] paramValues, boolean allowBatching, ReactiveConnection.Expectation expectation)
update
in interface ReactiveConnection
public CompletionStage<Void> execute(String sql)
execute
in interface ReactiveConnection
public CompletionStage<Void> executeUnprepared(String sql)
ReactiveConnection
executeUnprepared
in interface ReactiveConnection
public CompletionStage<Void> executeOutsideTransaction(String sql)
executeOutsideTransaction
in interface ReactiveConnection
public CompletionStage<Integer> update(String sql)
update
in interface ReactiveConnection
public CompletionStage<Integer> update(String sql, Object[] paramValues)
update
in interface ReactiveConnection
public CompletionStage<int[]> update(String sql, List<Object[]> paramValues)
update
in interface ReactiveConnection
public CompletionStage<Long> insertAndSelectIdentifier(String sql, Object[] paramValues)
insertAndSelectIdentifier
in interface ReactiveConnection
public CompletionStage<ReactiveConnection.Result> select(String sql)
select
in interface ReactiveConnection
public CompletionStage<ReactiveConnection.Result> select(String sql, Object[] paramValues)
select
in interface ReactiveConnection
public CompletionStage<ResultSet> selectJdbc(String sql, Object[] paramValues)
selectJdbc
in interface ReactiveConnection
public CompletionStage<ResultSet> selectJdbcOutsideTransaction(String sql, Object[] paramValues)
ReactiveConnection
selectJdbcOutsideTransaction
in interface ReactiveConnection
sql
- - the query to execute outside of a transactionparamValues
- - a non-null array of parameter valuespublic CompletionStage<Long> selectIdentifier(String sql, Object[] paramValues)
selectIdentifier
in interface ReactiveConnection
public CompletionStage<Void> beginTransaction()
beginTransaction
in interface ReactiveConnection
public CompletionStage<Void> commitTransaction()
commitTransaction
in interface ReactiveConnection
public CompletionStage<Void> rollbackTransaction()
rollbackTransaction
in interface ReactiveConnection
public CompletionStage<Void> close()
close
in interface ReactiveConnection
Copyright © 2020-2022 Red Hat, Inc. All Rights Reserved.