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
AReactiveConnection
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 givenReactiveConnection
which only supports explicit batching usingupdate(String, List)
.Note that in Hibernate core, the responsibilities of this class are handled by
JdbcCoordinator
and theBatch
interface. 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:
getDatabaseMetadata
in interfaceReactiveConnection
-
withBatchSize
public ReactiveConnection withBatchSize(int batchSize)
- Specified by:
withBatchSize
in interfaceReactiveConnection
-
executeBatch
public CompletionStage<Void> executeBatch()
- Specified by:
executeBatch
in interfaceReactiveConnection
-
update
public CompletionStage<Void> update(String sql, Object[] paramValues, boolean allowBatching, ReactiveConnection.Expectation expectation)
- Specified by:
update
in interfaceReactiveConnection
-
execute
public CompletionStage<Void> execute(String sql)
- Specified by:
execute
in interfaceReactiveConnection
-
executeUnprepared
public CompletionStage<Void> executeUnprepared(String sql)
Description copied from interface:ReactiveConnection
Run sql as statement (instead of preparedStatement)- Specified by:
executeUnprepared
in interfaceReactiveConnection
-
executeOutsideTransaction
public CompletionStage<Void> executeOutsideTransaction(String sql)
- Specified by:
executeOutsideTransaction
in interfaceReactiveConnection
-
update
public CompletionStage<Integer> update(String sql)
- Specified by:
update
in interfaceReactiveConnection
-
update
public CompletionStage<Integer> update(String sql, Object[] paramValues)
- Specified by:
update
in interfaceReactiveConnection
-
update
public CompletionStage<int[]> update(String sql, List<Object[]> paramValues)
- Specified by:
update
in interfaceReactiveConnection
-
insertAndSelectIdentifier
public <T> CompletionStage<T> insertAndSelectIdentifier(String sql, Object[] paramValues, Class<T> idClass, String idColumnName)
- Specified by:
insertAndSelectIdentifier
in interfaceReactiveConnection
-
insertAndSelectIdentifierAsResultSet
public CompletionStage<ResultSet> insertAndSelectIdentifierAsResultSet(String sql, Object[] paramValues, Class<?> idClass, String idColumnName)
- Specified by:
insertAndSelectIdentifierAsResultSet
in interfaceReactiveConnection
-
select
public CompletionStage<ReactiveConnection.Result> select(String sql)
- Specified by:
select
in interfaceReactiveConnection
-
select
public CompletionStage<ReactiveConnection.Result> select(String sql, Object[] paramValues)
- Specified by:
select
in interfaceReactiveConnection
-
selectJdbc
public CompletionStage<ResultSet> selectJdbc(String sql, Object[] paramValues)
- Specified by:
selectJdbc
in interfaceReactiveConnection
-
selectJdbcOutsideTransaction
public CompletionStage<ResultSet> selectJdbcOutsideTransaction(String sql, Object[] paramValues)
Description copied from interface:ReactiveConnection
This 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:
selectJdbcOutsideTransaction
in 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:
selectIdentifier
in interfaceReactiveConnection
-
beginTransaction
public CompletionStage<Void> beginTransaction()
- Specified by:
beginTransaction
in interfaceReactiveConnection
-
commitTransaction
public CompletionStage<Void> commitTransaction()
- Specified by:
commitTransaction
in interfaceReactiveConnection
-
rollbackTransaction
public CompletionStage<Void> rollbackTransaction()
- Specified by:
rollbackTransaction
in interfaceReactiveConnection
-
close
public CompletionStage<Void> close()
- Specified by:
close
in interfaceReactiveConnection
-
-