Fix R2dbcEntityTemplate.getRowsFetchSpec(…)
to use the correct Converter
for result type conversion
#1723
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change fixes a bug introduced with version 3.2.2 of spring-data-r2dbc.
Scenario:
An entity
ExampleEntity
exists, along with a ReactiveCrudRepositoryExampleRepository
.ExampleEntity
has following fields:ExampleRepository
has following method: {Additionally, an explicit converter exists for ExampleEntity:
Up until Version 3.2.1, invoking
ExampleRepository.countBySomeFieldEqualsTest
worked.Upon invocation, at some point, the method changed in this Pull Request
getRowsFetchSpec
checks which, if any, converter shall be used for converting the row fetched from the database.The implementation up until 3.2.1 was:
however, the new implementation breaks things:
Becuase of this, the result of the "SELECT COUNT(*)..." query above is fed into RowToExampleEntityConverter.convert, which expects a different input format.
By switching around these two if-blocks, the implementation works again in the shown scenario, which is why I would like to propose this change.