@EachBean(value=io.r2dbc.spi.ConnectionFactory.class) @Internal public final class DefaultR2dbcRepositoryOperations extends AbstractSqlRepositoryOperations<io.r2dbc.spi.Connection,io.r2dbc.spi.Row,io.r2dbc.spi.Statement,java.lang.RuntimeException> implements BlockingReactorRepositoryOperations, R2dbcRepositoryOperations, R2dbcOperations, ReactiveTransactionOperations<io.r2dbc.spi.Connection>
AbstractSqlRepositoryOperations.BaseOperations<T>, AbstractSqlRepositoryOperations.CascadeContext, AbstractSqlRepositoryOperations.CascadeManyOp, AbstractSqlRepositoryOperations.CascadeOneOp, AbstractSqlRepositoryOperations.CascadeOp, AbstractSqlRepositoryOperations.DBOperation1<In,Exc extends java.lang.Exception>, AbstractSqlRepositoryOperations.DBOperation2<In1,In2,Exc extends java.lang.Exception>, AbstractSqlRepositoryOperations.EntitiesOperations<T>, AbstractSqlRepositoryOperations.EntityOperations<T>, AbstractSqlRepositoryOperations.SqlOperation, AbstractSqlRepositoryOperations.StatementSupplier<PS>, AbstractSqlRepositoryOperations.StoredAnnotationMetadataSqlOperation, AbstractSqlRepositoryOperations.StoredSqlOperation
ReactiveTransactionOperations.TransactionalCallback<C,T>
columnIndexResultSetReader, columnNameResultSetReader, dateTimeProvider, DEFAULT_SQL_BUILDER, entityEventRegistry, jsonCodec, preparedStatementWriter, QUERY_LOG, queryBuilders, runtimeEntityRegistry
Modifier | Constructor and Description |
---|---|
protected |
DefaultR2dbcRepositoryOperations(java.lang.String dataSourceName,
io.r2dbc.spi.ConnectionFactory connectionFactory,
java.util.List<io.micronaut.http.codec.MediaTypeCodec> mediaTypeCodecList,
DateTimeProvider<java.lang.Object> dateTimeProvider,
RuntimeEntityRegistry runtimeEntityRegistry,
io.micronaut.context.ApplicationContext applicationContext,
java.util.concurrent.ExecutorService executorService)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
AsyncRepositoryOperations |
async() |
io.r2dbc.spi.ConnectionFactory |
connectionFactory()
Obtains the connection factory.
|
protected void |
prepareStatement(io.r2dbc.spi.Connection connection,
Dialect dialect,
PersistentProperty identity,
boolean hasGeneratedID,
java.lang.String insertSql,
AbstractSqlRepositoryOperations.DBOperation1<io.r2dbc.spi.Statement,java.lang.RuntimeException> fn)
Prepare a statement and run a function.
|
protected void |
prepareStatement(io.r2dbc.spi.Connection connection,
java.lang.String query,
AbstractSqlRepositoryOperations.DBOperation1<io.r2dbc.spi.Statement,java.lang.RuntimeException> fn)
Prepare a statement and run a function.
|
ReactorReactiveRepositoryOperations |
reactive() |
protected int |
shiftIndex(int i)
Used to define the index whether it is 1 based (JDBC) or 0 based (R2DBC).
|
<T> org.reactivestreams.Publisher<T> |
withConnection(java.util.function.Function<io.r2dbc.spi.Connection,org.reactivestreams.Publisher<T>> handler)
Execute the given handler with a new connection.
|
<T> org.reactivestreams.Publisher<T> |
withTransaction(ReactiveTransactionStatus<io.r2dbc.spi.Connection> status,
ReactiveTransactionOperations.TransactionalCallback<io.r2dbc.spi.Connection,T> handler)
Execute the given handler with an existing transaction status.
|
<T> reactor.core.publisher.Flux<T> |
withTransaction(TransactionDefinition definition,
ReactiveTransactionOperations.TransactionalCallback<io.r2dbc.spi.Connection,T> handler)
Execute the given handler with a new transaction.
|
afterCascadedMany, afterCascadedOne, cascade, checkOptimisticLocking, deleteInBatch, deleteOne, getApplicationContext, getEntity, getIdReader, isOnlySingleEndedJoins, isSqlServerWithoutOrderBy, isSupportsBatchDelete, isSupportsBatchInsert, isSupportsBatchUpdate, persistInBatch, persistJoinTableAssociation, persistOne, prepareStatement, resolveAssociationInsert, resolveEntityInsert, resolveEntityUpdate, setStatementParameter, sizeOf, sortById, triggerPostLoad, updateInBatch, updateOne
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
count, delete, deleteAll, executeUpdate, exists, findAll, findAll, findOne, findOne, findPage, findStream, findStream, persist, persistAll, update
executeDelete, getEntity, getQueryHints, updateAll
getApplicationContext
withTransaction
@Internal protected DefaultR2dbcRepositoryOperations(@Parameter java.lang.String dataSourceName, io.r2dbc.spi.ConnectionFactory connectionFactory, java.util.List<io.micronaut.http.codec.MediaTypeCodec> mediaTypeCodecList, @NonNull DateTimeProvider<java.lang.Object> dateTimeProvider, RuntimeEntityRegistry runtimeEntityRegistry, io.micronaut.context.ApplicationContext applicationContext, @Nullable @Named(value="io") java.util.concurrent.ExecutorService executorService)
dataSourceName
- The data source nameconnectionFactory
- The associated connection factorymediaTypeCodecList
- The media type codec listdateTimeProvider
- The date time providerruntimeEntityRegistry
- The runtime entity registryapplicationContext
- The bean contextexecutorService
- The executorprotected void prepareStatement(io.r2dbc.spi.Connection connection, java.lang.String query, AbstractSqlRepositoryOperations.DBOperation1<io.r2dbc.spi.Statement,java.lang.RuntimeException> fn)
AbstractSqlRepositoryOperations
prepareStatement
in class AbstractSqlRepositoryOperations<io.r2dbc.spi.Connection,io.r2dbc.spi.Row,io.r2dbc.spi.Statement,java.lang.RuntimeException>
connection
- The connection.query
- The queryfn
- The function to be run with a statementprotected void prepareStatement(io.r2dbc.spi.Connection connection, Dialect dialect, PersistentProperty identity, boolean hasGeneratedID, java.lang.String insertSql, AbstractSqlRepositoryOperations.DBOperation1<io.r2dbc.spi.Statement,java.lang.RuntimeException> fn)
AbstractSqlRepositoryOperations
prepareStatement
in class AbstractSqlRepositoryOperations<io.r2dbc.spi.Connection,io.r2dbc.spi.Row,io.r2dbc.spi.Statement,java.lang.RuntimeException>
connection
- The connectiondialect
- The dialectidentity
- The identity propertyhasGeneratedID
- Is genereted idenntityinsertSql
- Te queryfn
- The function to be run with a statementprotected int shiftIndex(int i)
AbstractSqlRepositoryOperations
shiftIndex
in class AbstractSqlRepositoryOperations<io.r2dbc.spi.Connection,io.r2dbc.spi.Row,io.r2dbc.spi.Statement,java.lang.RuntimeException>
i
- The index to shift@NonNull public ReactorReactiveRepositoryOperations reactive()
reactive
in interface ReactiveCapableRepository
reactive
in interface ReactorReactiveCapableRepository
@NonNull public AsyncRepositoryOperations async()
async
in interface AsyncCapableRepository
@NonNull public io.r2dbc.spi.ConnectionFactory connectionFactory()
R2dbcOperations
connectionFactory
in interface R2dbcOperations
@NonNull public <T> org.reactivestreams.Publisher<T> withConnection(@NonNull java.util.function.Function<io.r2dbc.spi.Connection,org.reactivestreams.Publisher<T>> handler)
R2dbcOperations
withConnection
in interface R2dbcOperations
T
- The emitted typehandler
- The handler@NonNull public <T> org.reactivestreams.Publisher<T> withTransaction(@NonNull ReactiveTransactionStatus<io.r2dbc.spi.Connection> status, @NonNull ReactiveTransactionOperations.TransactionalCallback<io.r2dbc.spi.Connection,T> handler)
R2dbcOperations
withTransaction
in interface R2dbcOperations
T
- The emitted typestatus
- An existing in progress transaction statushandler
- The handler@NonNull public <T> reactor.core.publisher.Flux<T> withTransaction(@NonNull TransactionDefinition definition, @NonNull ReactiveTransactionOperations.TransactionalCallback<io.r2dbc.spi.Connection,T> handler)
ReactiveTransactionOperations
withTransaction
in interface ReactiveTransactionOperations<io.r2dbc.spi.Connection>
T
- The emitted typedefinition
- The definitionhandler
- The handler