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 ReactiveDataAccessStrategy
ReactiveDataAccessStrategy.NamedParameterProvider -
Constructor Summary
ConstructorsConstructorDescriptionDefaultReactiveDataAccessStrategy(R2dbcDialect dialect, Collection<?> converters) DefaultReactiveDataAccessStrategy(R2dbcDialect dialect, R2dbcConverter converter) -
Method Summary
Modifier and TypeMethodDescriptionstatic R2dbcConvertercreateConverter(R2dbcDialect dialect, Collection<?> converters) getAllColumns(Class<?> entityType) getBindValue(Parameter value) Return a potentially convertedParameterfor strategies that support type conversion.Returns theR2dbcConverter.getIdentifierColumns(Class<?> entityType) MappingContext<RelationalPersistentEntity<?>, ? extends RelationalPersistentProperty> getOutboundRow(Object object) Returns aOutboundRowthat maps column names to aParametervalue.<T> BiFunction<Row, RowMetadata, T> getRowMapper(Class<T> typeToRead) Returns theR2dbcDialect-specificStatementMapper.getTableName(Class<?> type) processNamedParameters(String query, ReactiveDataAccessStrategy.NamedParameterProvider parameterProvider) Expand named parameters and return aPreparedOperationwrapping the given bindings.renderForGeneratedValues(SqlIdentifier identifier) Render aSqlIdentifierin a way suitable for registering it as a generated key with a statement throughStatement#returnGeneratedValues.toRowDocument(Class<?> type, Readable row, Iterable<? extends ReadableMetadata> metadata) Create a flatRowDocumentfrom a singleRow or Stored Procedure output.toSql(SqlIdentifier identifier) Render aSqlIdentifierfor SQL usage.
-
Constructor Details
-
DefaultReactiveDataAccessStrategy
- Parameters:
dialect- theR2dbcDialectto use.
-
DefaultReactiveDataAccessStrategy
- Parameters:
dialect- theR2dbcDialectto use.converters- custom converters to register, must not be null.- See Also:
-
DefaultReactiveDataAccessStrategy
- Parameters:
dialect- theR2dbcDialectto use.converter- must not be null.
-
-
Method Details
-
createConverter
- Parameters:
dialect- must not be null.converters- must not be null.- Returns:
- the
R2dbcConverter.
-
getAllColumns
- Specified by:
getAllColumnsin interfaceReactiveDataAccessStrategy- Parameters:
entityType-- Returns:
- all column names for a specific type.
-
getIdentifierColumns
- Specified by:
getIdentifierColumnsin interfaceReactiveDataAccessStrategy- Parameters:
entityType-- Returns:
- all Id column names for a specific type.
-
getOutboundRow
Description copied from interface:ReactiveDataAccessStrategyReturns aOutboundRowthat maps column names to aParametervalue.- Specified by:
getOutboundRowin interfaceReactiveDataAccessStrategy- Parameters:
object- must not be null.- Returns:
-
getBindValue
Description copied from interface:ReactiveDataAccessStrategyReturn a potentially convertedParameterfor strategies that support type conversion.- Specified by:
getBindValuein interfaceReactiveDataAccessStrategy- Parameters:
value- must not be null.- Returns:
-
getRowMapper
Description copied from interface:ReactiveDataAccessStrategy- Specified by:
getRowMapperin interfaceReactiveDataAccessStrategy- Type Parameters:
T-- Parameters:
typeToRead-- Returns:
-
toRowDocument
public RowDocument toRowDocument(Class<?> type, Readable row, Iterable<? extends ReadableMetadata> metadata) Description copied from interface:ReactiveDataAccessStrategyCreate a flatRowDocumentfrom a singleRow or Stored Procedure output.- Specified by:
toRowDocumentin interfaceReactiveDataAccessStrategy- Parameters:
type- the underlying entity type.row- the row or stored procedure output to retrieve data from.metadata- readable metadata.- Returns:
- the
RowDocumentcontaining the data.
-
processNamedParameters
public PreparedOperation<?> processNamedParameters(String query, ReactiveDataAccessStrategy.NamedParameterProvider parameterProvider) Description copied from interface:ReactiveDataAccessStrategyExpand named parameters and return aPreparedOperationwrapping the given bindings.- Specified by:
processNamedParametersin interfaceReactiveDataAccessStrategy- Parameters:
query- the query to expand.parameterProvider- indexed parameter bindings.- Returns:
- the
PreparedOperationencapsulating expanded SQL and namedBindings.
-
getTableName
- Specified by:
getTableNamein interfaceReactiveDataAccessStrategy- Parameters:
type-- Returns:
- the table name for the
entity type.
-
toSql
Description copied from interface:ReactiveDataAccessStrategyRender aSqlIdentifierfor SQL usage.- Specified by:
toSqlin interfaceReactiveDataAccessStrategy- Parameters:
identifier- the identifier to be rendered.- Returns:
- the SQL representation of the identifier with applied, potentially dialect-specific, processing rules.
- See Also:
-
getStatementMapper
Description copied from interface:ReactiveDataAccessStrategyReturns theR2dbcDialect-specificStatementMapper.- Specified by:
getStatementMapperin interfaceReactiveDataAccessStrategy- Returns:
- the
R2dbcDialect-specificStatementMapper.
-
getConverter
Description copied from interface:ReactiveDataAccessStrategyReturns theR2dbcConverter.- Specified by:
getConverterin interfaceReactiveDataAccessStrategy- Returns:
- the
R2dbcConverter.
-
getMappingContext
public MappingContext<RelationalPersistentEntity<?>, ? extends RelationalPersistentProperty> getMappingContext() -
renderForGeneratedValues
Description copied from interface:ReactiveDataAccessStrategyRender aSqlIdentifierin a way suitable for registering it as a generated key with a statement throughStatement#returnGeneratedValues.- Specified by:
renderForGeneratedValuesin interfaceReactiveDataAccessStrategy- Parameters:
identifier- to render. Must not be null.- Returns:
- rendered identifier. Guaranteed to be not null.
-
getDialect
- Specified by:
getDialectin interfaceReactiveDataAccessStrategy- Returns:
- the
Dialectused by this strategy. - Since:
- 3.4
-