spring-data-r2dbc
spring-data-r2dbc copied to clipboard
1.2.0 - migration of fluent API without entity classes
With 1.1.x it was possible to use:
databaseClient.insert().into("table_name")
databaseClient.update().table("table_name")
databaseClient.delete().from("table_name")
without any entity classes.
In 1.2.0 org.springframework.data.r2dbc.core.DatabaseClient
is deprecated in favor of org.springframework.r2dbc.core.DatabaseClient
and R2dbcEntityTemplate
, but neither of them seem to support this kind of operations. What is the correct migration path?
We don't provide a SQL construction DSL anymore. You can use the SQL builder API from org.springframework.data.relational.core.sql
directly or tools like jOOQ if you like.
But the whole DSL is still there. Looking at the current docs:
https://docs.spring.io/spring-data/r2dbc/docs/1.2.0/reference/html/#r2dbc.entityoperations.fluent-api
we still have matching
function, the Criteria
class with all the operators and we can even provide the table name.
As far as I understand the example code: https://docs.spring.io/spring-data/r2dbc/docs/1.2.0/api/org/springframework/data/r2dbc/core/ReactiveUpdateOperation.html the entity class itself is not even used here for anything.
I've got a few medium sized applications with lots of code based on r2dbc fluent api running with current Spring Boot. Please consider a better migration path for people like me :-)
+1 This would be great. I also have the same usages of insert.into("")/update.table("table").
So a bit of a pain migrating away from that right now.
Take attention to possible SQL injections, if you pass values directly to SQL builder API
I have created a small Kotlin project, which addresses this issue: https://github.com/rjaros/r2dbc-e4k