Questions tagged [spring-data-r2dbc]

Spring Data R2DBC is a module of Spring Data based on R2DBC R2DBC stands for Reactive Relational Database Connectivity.

See https://spring.io/projects/spring-data-r2dbc for more information.

412 questions
3
votes
1 answer

R2DBC can be used for change data capture in Spring boot?

I have a classic Spring Boot Application connected to a MySQL database. Can I use r2dbc driver and spring data r2dbc to develop another application that listens to the database changes like a change data capture? I've studied the r2dbc driver…
3
votes
1 answer

How to implement ManyToMany in r2dbc

R2DBC does not support composite keys currently. I wonder how we may implement a many-to-many relationship for now? For example, given the two entities: @Table class Item( @Id var id: Long?, var title: String, var description:…
Stuck
  • 11,225
  • 11
  • 59
  • 104
3
votes
0 answers

Spring Data R2DBC mysql - Log query and query parameter

I am using Spring data r2dbc for mysql. implementation 'org.springframework.boot:spring-boot-starter-data-r2dbc' runtimeOnly 'dev.miku:r2dbc-mysql' runtimeOnly 'mysql:mysql-connector-java' I am able to print the query using the below log…
user1578872
  • 7,808
  • 29
  • 108
  • 206
3
votes
2 answers

r2dbc ReactiveCrudRepository how to write JPQL/HQL

I'm new to Spring WebFlux reactive. I use R2DBC postgresql. I have a repository like that: public interface BookRepository extends ReactiveCrudRepository { } Now I want to add custom method to query by many complicated…
SoT
  • 898
  • 1
  • 15
  • 36
3
votes
1 answer

Spring R2DBC: How to replace deprecated DatabaseClient.as(…) and handle custom types/converters for jsonb field

I have a problem with objects mapping after migrating to Spring Boot 2.4. So far I was using Spring Boot 2.3 (with Kotlin). For the sample database query override fun findMyEntities(searchParams: SearchParams): Flux = …
Pawel
  • 466
  • 1
  • 7
  • 20
3
votes
3 answers

initialize database for testing purpose on Spring Data R2DBC

In a non-test environment, I can set up the bean to initialize the database with the schema.sql like this @Bean ConnectionFactoryInitializer initializer(@Qualifier("connectionFactory") ConnectionFactory connectionFactory) { …
kamalhm
  • 126
  • 2
  • 10
3
votes
1 answer

Spring Boot 2.4 mixed project with JPA and R2DBC doesn't start

I'm working on an existing Spring Boot 2.4 project and trying to bring in Webflux and R2DBC into an existing JPA based app. I'm able to bring in the Webflux dependency: org.springframework.boot
3
votes
1 answer

When using Spring R2DBC repositories can I provide my own custom R2dbcEntityTemplate?

I can make required tweaks via: @EnableR2dbcRepositories(repositoryBaseClass = BaseRepo::class) but this is too high level. Essentially I override top level method with custom behaviour which needs to be done at R2dbcEntityTemplate.class level so…
Aubergine
  • 5,862
  • 19
  • 66
  • 110
3
votes
1 answer

do we a shorthand to get a count of number of rows are present in db with respect to a where clause in r2bc

"Is there any short hand to no .of rows in a database against a where condition" if we have a criteria definition present against which want number of rows present in database. is is any function in r2dbc that give that?
3
votes
2 answers

How does a R2DBC repository work with Postgis geometries?

I had a couple of entity classes that worked with Spring Data JPA. (These entity classes are in a postgres db with postgis installed and contain geometry fields.) However, when I switched to r2dbc, it did not work. Any pointers will be…
Tisha
  • 827
  • 3
  • 11
  • 34
3
votes
1 answer

spring R2DBC query by enum type

My PostgreSQL contains an enum like create type my_type as enum('VAL1', 'VAL2') in Spring boot app, it is represented by MyType.class enum I'm trying to run a simple query using DatabasClient client.exectute("select * from table where type =…
royB
  • 12,779
  • 15
  • 58
  • 80
3
votes
1 answer

How to run query like @Sql for test in Spring Data R2DBC

I created a Repository and writing a Test Case. I want to run insert.sql before executing the test method with @Sql (org.springframework.test.context.jdbc) but it doesn't run. Is there another way?
Amuzr
  • 106
  • 10
3
votes
2 answers

Spring Data R2DBC parameters conditional binding for SQL query

I am facing a difficulty to bind a conditional parameters to SQL query using Spring Data R2DBC DatabaseClient. Two parameters can be null. Since the DatabaseClient requires to specify explicitly that the parameter is null, I have tried the following…
3
votes
1 answer

SQL builder for CockroachDb

Try to find any SQL builder library that support CockroachDb and work well with spring-boot-webflux, spring-data-r2dbc. Or at least library that will just write dynamic SQL statement as string for me that I will provide to database client executor.…
Viktor M.
  • 4,393
  • 9
  • 40
  • 71
3
votes
0 answers

Application.properties and r2dbc

I use spring boot 2.2 with spring cloud Hoxton.SR1. I don't have any config class for my db. I only have an application.properties to setup database. In my application.properties, I…
robert trudel
  • 5,283
  • 17
  • 72
  • 124