Class DefaultReactiveDataAccessStrategy
java.lang.Object
org.springframework.data.r2dbc.core.DefaultReactiveDataAccessStrategy
- All Implemented Interfaces:
ReactiveDataAccessStrategy
Default
ReactiveDataAccessStrategy
implementation.- Author:
- Mark Paluch, Louis Morgan, Jens Schauder
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.data.r2dbc.core.ReactiveDataAccessStrategy
ReactiveDataAccessStrategy.NamedParameterProvider
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultReactiveDataAccessStrategy
(R2dbcDialect dialect, Collection<?> converters) DefaultReactiveDataAccessStrategy
(R2dbcDialect dialect, R2dbcConverter converter) -
Method Summary
Modifier and TypeMethodDescriptionstatic R2dbcConverter
createConverter
(R2dbcDialect dialect, Collection<?> converters) List<org.springframework.data.relational.core.sql.SqlIdentifier>
getAllColumns
(Class<?> entityType) getBindValue
(Parameter value) Return a potentially convertedParameter
for strategies that support type conversion.Returns theR2dbcConverter
.org.springframework.data.relational.core.dialect.Dialect
List<org.springframework.data.relational.core.sql.SqlIdentifier>
getIdentifierColumns
(Class<?> entityType) MappingContext<org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?>,
? extends org.springframework.data.relational.core.mapping.RelationalPersistentProperty> getOutboundRow
(Object object) Returns aOutboundRow
that maps column names to aParameter
value.<T> BiFunction<Row,
RowMetadata, T> getRowMapper
(Class<T> typeToRead) Returns theR2dbcDialect
-specificStatementMapper
.org.springframework.data.relational.core.sql.SqlIdentifier
getTableName
(Class<?> type) processNamedParameters
(String query, ReactiveDataAccessStrategy.NamedParameterProvider parameterProvider) Expand named parameters and return aPreparedOperation
wrapping the given bindings.renderForGeneratedValues
(org.springframework.data.relational.core.sql.SqlIdentifier identifier) Render aSqlIdentifier
in a way suitable for registering it as a generated key with a statement throughStatement#returnGeneratedValues
.org.springframework.data.relational.domain.RowDocument
toRowDocument
(Class<?> type, Readable row, Iterable<? extends ReadableMetadata> metadata) Create a flatRowDocument
from a singleRow or Stored Procedure output
.toSql
(org.springframework.data.relational.core.sql.SqlIdentifier identifier) Render aSqlIdentifier
for SQL usage.
-
Constructor Details
-
DefaultReactiveDataAccessStrategy
- Parameters:
dialect
- theR2dbcDialect
to use.
-
DefaultReactiveDataAccessStrategy
- Parameters:
dialect
- theR2dbcDialect
to use.converters
- custom converters to register, must not be null.- See Also:
-
DefaultReactiveDataAccessStrategy
- Parameters:
dialect
- theR2dbcDialect
to use.converter
- must not be null.
-
-
Method Details
-
createConverter
- Parameters:
dialect
- must not be null.converters
- must not be null.- Returns:
- the
R2dbcConverter
.
-
getAllColumns
public List<org.springframework.data.relational.core.sql.SqlIdentifier> getAllColumns(Class<?> entityType) - Specified by:
getAllColumns
in interfaceReactiveDataAccessStrategy
- Returns:
- all column names for a specific type.
-
getIdentifierColumns
public List<org.springframework.data.relational.core.sql.SqlIdentifier> getIdentifierColumns(Class<?> entityType) - Specified by:
getIdentifierColumns
in interfaceReactiveDataAccessStrategy
- Returns:
- all Id column names for a specific type.
-
getOutboundRow
Description copied from interface:ReactiveDataAccessStrategy
Returns aOutboundRow
that maps column names to aParameter
value.- Specified by:
getOutboundRow
in interfaceReactiveDataAccessStrategy
- Parameters:
object
- must not be null.- Returns:
-
getBindValue
Description copied from interface:ReactiveDataAccessStrategy
Return a potentially convertedParameter
for strategies that support type conversion.- Specified by:
getBindValue
in interfaceReactiveDataAccessStrategy
- Parameters:
value
- must not be null.- Returns:
-
getRowMapper
Description copied from interface:ReactiveDataAccessStrategy
- Specified by:
getRowMapper
in interfaceReactiveDataAccessStrategy
- Returns:
-
toRowDocument
public org.springframework.data.relational.domain.RowDocument toRowDocument(Class<?> type, Readable row, Iterable<? extends ReadableMetadata> metadata) Description copied from interface:ReactiveDataAccessStrategy
Create a flatRowDocument
from a singleRow or Stored Procedure output
.- Specified by:
toRowDocument
in interfaceReactiveDataAccessStrategy
- Parameters:
type
- the underlying entity type.row
- the row or stored procedure output to retrieve data from.metadata
- readable metadata.- Returns:
- the
RowDocument
containing the data.
-
processNamedParameters
public PreparedOperation<?> processNamedParameters(String query, ReactiveDataAccessStrategy.NamedParameterProvider parameterProvider) Description copied from interface:ReactiveDataAccessStrategy
Expand named parameters and return aPreparedOperation
wrapping the given bindings.- Specified by:
processNamedParameters
in interfaceReactiveDataAccessStrategy
- Parameters:
query
- the query to expand.parameterProvider
- indexed parameter bindings.- Returns:
- the
PreparedOperation
encapsulating expanded SQL and namedBindings.
-
getTableName
- Specified by:
getTableName
in interfaceReactiveDataAccessStrategy
- Returns:
- the table name for the
entity type
.
-
toSql
Description copied from interface:ReactiveDataAccessStrategy
Render aSqlIdentifier
for SQL usage.- Specified by:
toSql
in interfaceReactiveDataAccessStrategy
- Parameters:
identifier
- the identifier to be rendered.- Returns:
- the SQL representation of the identifier with applied, potentially dialect-specific, processing rules.
- See Also:
-
SqlIdentifier.toSql(IdentifierProcessing)
-
getStatementMapper
Description copied from interface:ReactiveDataAccessStrategy
Returns theR2dbcDialect
-specificStatementMapper
.- Specified by:
getStatementMapper
in interfaceReactiveDataAccessStrategy
- Returns:
- the
R2dbcDialect
-specificStatementMapper
.
-
getConverter
Description copied from interface:ReactiveDataAccessStrategy
Returns theR2dbcConverter
.- Specified by:
getConverter
in interfaceReactiveDataAccessStrategy
- Returns:
- the
R2dbcConverter
.
-
getMappingContext
public MappingContext<org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?>,? extends org.springframework.data.relational.core.mapping.RelationalPersistentProperty> getMappingContext() -
renderForGeneratedValues
public String renderForGeneratedValues(org.springframework.data.relational.core.sql.SqlIdentifier identifier) Description copied from interface:ReactiveDataAccessStrategy
Render aSqlIdentifier
in a way suitable for registering it as a generated key with a statement throughStatement#returnGeneratedValues
.- Specified by:
renderForGeneratedValues
in interfaceReactiveDataAccessStrategy
- Parameters:
identifier
- to render. Must not be null.- Returns:
- rendered identifier. Guaranteed to be not null.
-
getDialect
public org.springframework.data.relational.core.dialect.Dialect getDialect()- Specified by:
getDialect
in interfaceReactiveDataAccessStrategy
- Returns:
- the
Dialect
used by this strategy. - Since:
- 3.4
-