-
Notifications
You must be signed in to change notification settings - Fork 132
Refactor Spring Data R2DBC on top of Spring R2DBC #412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
+1,027
−2,249
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
[appendix] | ||
[[migration-guide]] | ||
= Migration Guide | ||
|
||
The following sections explain how to migrate to a newer version of Spring Data R2DBC. | ||
|
||
[[upgrading.1.1-1.2]] | ||
== Upgrading from 1.1.x to 1.2.x | ||
|
||
Spring Data R2DBC was developed with the intent to evaluate how well R2DBC can integrate with Spring applications. | ||
One of the main aspects was to move core support into Spring Framework once R2DBC support has proven useful. | ||
Spring Framework 5.3 ships with a new module: Spring R2DBC (`spring-r2dbc`). | ||
|
||
`spring-r2dbc` ships core R2DBC functionality (a slim variant of `DatabaseClient`, Transaction Manager, Connection Factory initialization, Exception translation) that was initially provided by Spring Data R2DBC. The 1.2.0 release aligns with what's provided in Spring R2DBC by making several changes outlined in the following sections. | ||
|
||
Spring R2DBC's `DatabaseClient` is a more lightweight implementation that encapsulates a pure SQL-oriented interface. | ||
You will notice that the method to run SQL statements changed from `DatabaseClient.execute(…)` to `DatabaseClient.sql(…)`. | ||
The fluent API for CRUD operations has moved into `R2dbcEntityTemplate`. | ||
|
||
[[upgrading.1.1-1.2.deprecation]] | ||
=== Deprecations | ||
|
||
* Deprecation of `o.s.d.r2dbc.core.DatabaseClient` and its support classes `ConnectionAccessor`, `FetchSpec`, `SqlProvider` and a few more. | ||
Named parameter support classes such as `NamedParameterExpander` are encapsulated by Spring R2DBC's `DatabaseClient` implementation hence we're not providing replacements as this was internal API in the first place. | ||
Use `o.s.r2dbc.core.DatabaseClient` and their Spring R2DBC replacements available from `org.springframework.r2dbc.core`. | ||
Entity-based methods (`select`/`insert`/`update`/`delete`) methods are available through `R2dbcEntityTemplate` which was introduced with version 1.1. | ||
* Deprecation of `o.s.d.r2dbc.connectionfactory`, `o.s.d.r2dbc.connectionfactory.init`, and `o.s.d.r2dbc.connectionfactory.lookup` packages. | ||
Use Spring R2DBC's variant which you can find at `o.s.r2dbc.connection`. | ||
* Deprecation of `o.s.d.r2dbc.convert.ColumnMapRowMapper`. | ||
Use `o.s.r2dbc.core.ColumnMapRowMapper` instead. | ||
* Deprecation of binding support classes `o.s.d.r2dbc.dialect.Bindings`, `BindMarker`, `BindMarkers`, `BindMarkersFactory` and related types. | ||
Use replacements from `org.springframework.r2dbc.core.binding`. | ||
* Deprecation of `BadSqlGrammarException`, `UncategorizedR2dbcException` and exception translation at `o.s.d.r2dbc.support`. | ||
Spring R2DBC provides a slim exception translation variant without an SPI for now available through `o.s.r2dbc.connection.ConnectionFactoryUtils#convertR2dbcException`. | ||
|
||
[[upgrading.1.1-1.2.replacements]] | ||
=== Usage of replacements provided by Spring R2DBC | ||
|
||
To ease migration, several deprecated types are now subtypes of their replacements provided by Spring R2DBC. Spring Data R2DBC has changes several methods or introduced new methods accepting Spring R2DBC types. | ||
Specifically the following classes are changed: | ||
|
||
* `R2dbcEntityTemplate` | ||
* `R2dbcDialect` | ||
* Types in `org.springframework.data.r2dbc.query` | ||
|
||
We recommend that you review and update your imports if you work with these types directly. | ||
|
||
=== Breaking Changes | ||
|
||
* `OutboundRow` and statement mappers switched from using `SettableValue` to `Parameter` | ||
* Repository factory support requires `o.s.r2dbc.core.DatabaseClient` instead of `o.s.data.r2dbc.core.DatabaseClient`. | ||
|
||
[[upgrading.1.1-1.2.dependencies]] | ||
=== Dependency Changes | ||
|
||
To make use of Spring R2DBC, make sure to include the following dependency: | ||
|
||
* `org.springframework:spring-r2dbc` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be done by the build tool for 99.9% of the users, shouldn't it?
I there for just mention it in the starting paragraph, that
spring-data-r2dbc
now depends onspring-r2dbc
.