The org.springframework.r2dbc DatabaseClient class has moved to
import org.springframework.r2dbc.core.DatabaseClient;
from
import org.springframework.data.r2dbc.core.DatabaseClient;
The Spring data documentation https://spring.io/projects/spring-data-r2dbc refers to a simple 'as' method to convert to an object
databaseClient
.sql("select * from reading")
.as(CrepsReading::class.java)
.fetch()
.all()
.asFlow()
It doesn't wok. Neither does map(class). Only mapping class seems to work.
val all: Flux<CrepsReading> = databaseClient
.sql("SELECT id, name FROM person")
.map(CrepsReading::class)
.fetch().all()
How do you map an object with spring-data-r2dbc (1.2.0) simply? Is there documentation that describes the use of the DatabaseClient that is part of spring-data-r2dbc?
as
function, asas
is a keyword in Kotlin. You have to put the call in backquotes, which I cannot demonstrate here due to my lack of Markdown knowledge. (How do I escape the backticks?) – Unprofitable.`as`(CrepsReading::class.java)
– Unprofitable