public interface R2dbcEntityOperations extends FluentR2dbcOperations
R2dbcEntityTemplate
. Not often used directly, but a useful option to enhance testability, as it can easily be
mocked or stubbed.DatabaseClient
ReactiveSelectOperation.ReactiveSelect<T>, ReactiveSelectOperation.SelectWithProjection<T>, ReactiveSelectOperation.SelectWithQuery<T>, ReactiveSelectOperation.SelectWithTable<T>, ReactiveSelectOperation.TerminatingSelect<T>
ReactiveInsertOperation.InsertWithTable<T>, ReactiveInsertOperation.ReactiveInsert<T>, ReactiveInsertOperation.TerminatingInsert<T>
ReactiveUpdateOperation.ReactiveUpdate, ReactiveUpdateOperation.TerminatingUpdate, ReactiveUpdateOperation.UpdateWithQuery, ReactiveUpdateOperation.UpdateWithTable
ReactiveDeleteOperation.DeleteWithQuery, ReactiveDeleteOperation.DeleteWithTable, ReactiveDeleteOperation.ReactiveDelete, ReactiveDeleteOperation.TerminatingDelete
Modifier and Type | Method and Description |
---|---|
reactor.core.publisher.Mono<Long> |
count(org.springframework.data.relational.core.query.Query query,
Class<?> entityClass)
Returns the number of rows for the given entity class applying
Query . |
reactor.core.publisher.Mono<Integer> |
delete(org.springframework.data.relational.core.query.Query query,
Class<?> entityClass)
Remove entities (rows)/columns from the table by
Query . |
<T> reactor.core.publisher.Mono<T> |
delete(T entity)
Delete the given entity and emit the entity if the delete was applied.
|
reactor.core.publisher.Mono<Boolean> |
exists(org.springframework.data.relational.core.query.Query query,
Class<?> entityClass)
Determine whether the result for
entityClass Query yields at least one row. |
R2dbcConverter |
getConverter()
Return the underlying
R2dbcConverter . |
ReactiveDataAccessStrategy |
getDataAccessStrategy()
Deprecated.
use
getConverter() instead as ReactiveDataAccessStrategy will be removed in a future
release. |
DatabaseClient |
getDatabaseClient()
Expose the underlying
DatabaseClient to allow SQL operations. |
<T> reactor.core.publisher.Mono<T> |
insert(T entity)
Insert the given entity and emit the entity if the insert was applied.
|
<T> RowsFetchSpec<T> |
query(PreparedOperation<?> operation,
BiFunction<Row,RowMetadata,T> rowMapper)
Execute a query for a
RowsFetchSpec , given PreparedOperation . |
<T> RowsFetchSpec<T> |
query(PreparedOperation<?> operation,
Class<?> entityClass,
BiFunction<Row,RowMetadata,T> rowMapper)
|
default <T> RowsFetchSpec<T> |
query(PreparedOperation<?> operation,
Class<?> entityClass,
Function<Row,T> rowMapper)
|
<T> RowsFetchSpec<T> |
query(PreparedOperation<?> operation,
Class<T> entityClass)
Execute a query for a
RowsFetchSpec , given PreparedOperation . |
default <T> RowsFetchSpec<T> |
query(PreparedOperation<?> operation,
Function<Row,T> rowMapper)
Execute a query for a
RowsFetchSpec , given PreparedOperation . |
<T> reactor.core.publisher.Flux<T> |
select(org.springframework.data.relational.core.query.Query query,
Class<T> entityClass)
Execute a
SELECT query and convert the resulting items to a stream of entities. |
<T> reactor.core.publisher.Mono<T> |
selectOne(org.springframework.data.relational.core.query.Query query,
Class<T> entityClass)
Execute a
SELECT query and convert the resulting item to an entity ensuring exactly one result. |
reactor.core.publisher.Mono<Integer> |
update(org.springframework.data.relational.core.query.Query query,
org.springframework.data.relational.core.query.Update update,
Class<?> entityClass)
Update the queried entities and return true if the update was applied.
|
<T> reactor.core.publisher.Mono<T> |
update(T entity)
Update the given entity and emit the entity if the update was applied.
|
select
insert
update
delete
DatabaseClient getDatabaseClient()
DatabaseClient
to allow SQL operations.DatabaseClient
.DatabaseClient
@Deprecated ReactiveDataAccessStrategy getDataAccessStrategy()
getConverter()
instead as ReactiveDataAccessStrategy
will be removed in a future
release.ReactiveDataAccessStrategy
encapsulating dialect specifics.ReactiveDataAccessStrategy
.ReactiveDataAccessStrategy
R2dbcConverter getConverter()
R2dbcConverter
.R2dbcConverter
.reactor.core.publisher.Mono<Long> count(org.springframework.data.relational.core.query.Query query, Class<?> entityClass) throws DataAccessException
Query
. This overridden method allows users
to further refine the selection Query using a Query
predicate to determine how many entities of the given
type
match the Query.query
- user-defined count Query
to execute; must not be null.entityClass
- type
of the entity; must not be null.DataAccessException
- if any problem occurs while executing the query.reactor.core.publisher.Mono<Boolean> exists(org.springframework.data.relational.core.query.Query query, Class<?> entityClass) throws DataAccessException
entityClass
Query
yields at least one row.query
- user-defined exists Query
to execute; must not be null.entityClass
- type
of the entity; must not be null.DataAccessException
- if any problem occurs while executing the query.<T> reactor.core.publisher.Flux<T> select(org.springframework.data.relational.core.query.Query query, Class<T> entityClass) throws DataAccessException
SELECT
query and convert the resulting items to a stream of entities.query
- must not be null.entityClass
- the entity type must not be null.DataAccessException
- if there is any problem issuing the execution.<T> reactor.core.publisher.Mono<T> selectOne(org.springframework.data.relational.core.query.Query query, Class<T> entityClass) throws DataAccessException
SELECT
query and convert the resulting item to an entity ensuring exactly one result.query
- must not be null.entityClass
- the entity type must not be null.Mono.empty()
if no match found.IncorrectResultSizeDataAccessException
- if more than one match found.DataAccessException
- if there is any problem issuing the execution.reactor.core.publisher.Mono<Integer> update(org.springframework.data.relational.core.query.Query query, org.springframework.data.relational.core.query.Update update, Class<?> entityClass) throws DataAccessException
query
- must not be null.update
- must not be null.entityClass
- the entity type must not be null.DataAccessException
- if there is any problem executing the query.reactor.core.publisher.Mono<Integer> delete(org.springframework.data.relational.core.query.Query query, Class<?> entityClass) throws DataAccessException
Query
.query
- must not be null.entityClass
- the entity type must not be null.DataAccessException
- if there is any problem issuing the execution.<T> RowsFetchSpec<T> query(PreparedOperation<?> operation, Class<T> entityClass) throws DataAccessException
RowsFetchSpec
, given PreparedOperation
. Any provided bindings within
PreparedOperation
are applied to the underlying DatabaseClient
. The query is issued as-is without
additional pre-processing such as named parameter expansion. Results of the query are mapped onto
entityClass
.operation
- the prepared operation wrapping a SQL query and bind parameters.entityClass
- the entity type must not be null.RowsFetchSpec
ready to materialize.DataAccessException
- if there is any problem issuing the execution.default <T> RowsFetchSpec<T> query(PreparedOperation<?> operation, Function<Row,T> rowMapper) throws DataAccessException
RowsFetchSpec
, given PreparedOperation
. Any provided bindings within
PreparedOperation
are applied to the underlying DatabaseClient
. The query is issued as-is without
additional pre-processing such as named parameter expansion. Results of the query are mapped using rowMapper
.operation
- the prepared operation wrapping a SQL query and bind parameters.rowMapper
- the row mapper must not be null.RowsFetchSpec
with rowMapper
applied ready to materialize.DataAccessException
- if there is any problem issuing the execution.query(PreparedOperation, BiFunction)
<T> RowsFetchSpec<T> query(PreparedOperation<?> operation, BiFunction<Row,RowMetadata,T> rowMapper) throws DataAccessException
RowsFetchSpec
, given PreparedOperation
. Any provided bindings within
PreparedOperation
are applied to the underlying DatabaseClient
. The query is issued as-is without
additional pre-processing such as named parameter expansion. Results of the query are mapped using
rowMapper
.operation
- the prepared operation wrapping a SQL query and bind parameters.rowMapper
- the row mapper must not be null.RowsFetchSpec
with rowMapper
applied ready to materialize.DataAccessException
- if there is any problem issuing the execution.default <T> RowsFetchSpec<T> query(PreparedOperation<?> operation, Class<?> entityClass, Function<Row,T> rowMapper) throws DataAccessException
RowsFetchSpec
in the context of entityClass
, given PreparedOperation
.
Any provided bindings within PreparedOperation
are applied to the underlying DatabaseClient
. The
query is issued as-is without additional pre-processing such as named parameter expansion. Results of the query are
mapped using rowMapper
.operation
- the prepared operation wrapping a SQL query and bind parameters.entityClass
- the entity type must not be null.rowMapper
- the row mapper must not be null.RowsFetchSpec
with rowMapper
applied ready to materialize.DataAccessException
- if there is any problem issuing the execution.query(PreparedOperation, Class, BiFunction)
<T> RowsFetchSpec<T> query(PreparedOperation<?> operation, Class<?> entityClass, BiFunction<Row,RowMetadata,T> rowMapper) throws DataAccessException
RowsFetchSpec
in the context of entityClass
, given PreparedOperation
.
Any provided bindings within PreparedOperation
are applied to the underlying DatabaseClient
. The
query is issued as-is without additional pre-processing such as named parameter expansion. Results of the query are
mapped using rowMapper
.operation
- the prepared operation wrapping a SQL query and bind parameters.entityClass
- the entity type must not be null.rowMapper
- the row mapper must not be null.RowsFetchSpec
with rowMapper
applied ready to materialize.DataAccessException
- if there is any problem issuing the execution.query(PreparedOperation, Class, BiFunction)
<T> reactor.core.publisher.Mono<T> insert(T entity) throws DataAccessException
entity
- the entity to insert, must not be null.DataAccessException
- if there is any problem issuing the execution.<T> reactor.core.publisher.Mono<T> update(T entity) throws DataAccessException
entity
- the entity to update, must not be null.DataAccessException
- if there is any problem issuing the execution.TransientDataAccessResourceException
- if the update did not affect any rows.<T> reactor.core.publisher.Mono<T> delete(T entity) throws DataAccessException
entity
- must not be null.DataAccessException
- if there is any problem issuing the execution.Copyright © 2018–2022 Pivotal Software, Inc.. All rights reserved.