Questions tagged [r2dbc]

R2DBC (Reactive Relational Database Connectivity) is an SPI which enables interacting with SQL database servers by executing SQL statements using a non-blocking reactive programming model with the Java programming language.

R2DBC is a Java-based, open source data access technology.

This technology is an SPI (Service Provider Interface) for the Java programming language that defines how a client may access a database using reactive programming. It specifies SPI methods for executing queries using a non-blocking driver. R2DBC is oriented towards relational databases.

Online resources

379 questions
4
votes
0 answers

R2DBC - PostgreSQL - Cannot exchange messages because the request queue limit is exceeded

Libraries: r2dbc-postgresql-0.8.6.RELEASE r2dbc-pool-0.8.5.RELEASE r2dbc-spi-0.8.3.RELEASE postgresql-42.2.18 List item Problem: I tried to bulk insert using R2DBC (PostgreSQL) with code as below: @Override public Flux test(List users)…
4
votes
1 answer

Connection-reuse and transactions (relationship)

How does R2DBC implement transaction-handling. As far as I know, JDBC use one connection for one transaction. So in Spring MVC we have the following mapping: 1 request : 1 thread : 1 transaction : 1 connection. What is the mapping in Webflux with…
4
votes
2 answers

TestContainers, Spring Webflux, JUnit 5, MySQLR2DBCDatabaseContainer using @DynamicPropertySource

I'm trying to do the following; but using org.testcontainers.containers.MySQLR2DBCDatabaseContainer can anyone show me how this can be achieved, as MySQLR2DBCDatabaseContainer doesn't seem to have the following…
4
votes
1 answer

Obtaining a nested objects using Spring Data R2DBC

I'm new to Project Reactor and R2DBC. How to receive and merge Flux with Mono properly using Spring Data R2DBC reactive repositories? Parent: @Table("parent") public class Parent{ @Id private Long id; private String…
4
votes
2 answers

It is possible to use JSON or JSONB postgresql datatypes with spring r2dbc manually?

Im building a new api with spring boot, webflux and r2dbc (postgresql). One of my tables will have a json or jsonb field, to store a dynamic json document. As for now, r2dbc does not support json datatypes for postgresql database. Im wondering if…
4
votes
1 answer

How to control flow of a transactional stream with Spring Data R2DBC?

Support for transactional streams seems to have been recently implemented but due to its newness, there are not many code examples. Could someone show an example of a transactional stream that does a series of database inserts and then returns some…
Ray Zhang
  • 1,411
  • 4
  • 18
  • 36
4
votes
1 answer

How to retrieve a generated ID when saving objects with Spring Data R2DBC using Postgresql

Could you please help me to solve the problem below I have a entity class: @Data @AllArgsConstructor @NoArgsConstructor public class User { @Id private Long id; private String name; } and I save it in Postgresql with the code: public…
Khai Ly
  • 135
  • 3
  • 7
3
votes
2 answers

Spring r2dbc custom Json converter not working

I am trying to insert json into json column using spring webflux with postgres sql. I have created custom converter for reading and writing. The issue is existing json values becomes null, whenever trying to update the record. The new value is…
3
votes
0 answers

Using $1 in the @Query throws exception: Cannot encode parameter of type org.springframework.r2dbc.core.Parameter

I'm using R2DBC in my project. After upgrading to Spring Boot from 2.5.* to 2.6.1 my query: @Query("SELECT EXISTS(SELECT 1 FROM some_link links WHERE links.data_id = $1 AND links.some_id != links.source_id)") fun…
Pawel
  • 466
  • 1
  • 7
  • 20
3
votes
1 answer

Spring data R2DBC, saveAll() in one sql query

In ReactiveCrudRepository we have saveAll methods reactor.core.publisher.Flux saveAll(org.reactivestreams.Publisher entityStream) reactor.core.publisher.Flux saveAll(Iterable entities) When we save collection…
Adasiek
  • 65
  • 1
  • 7
3
votes
2 answers

Micronaut error on calling repositry Context does not contain key: io.micronaut.tx.STATUS

import io.micronaut.core.annotation.NonNull; import io.micronaut.data.annotation.GeneratedValue; import io.micronaut.data.annotation.Id; import io.micronaut.data.annotation.MappedEntity; import…
Parasite2142
  • 33
  • 1
  • 5
3
votes
1 answer

How do we initialize schema in Testcontainers R2DBC?

Currently, I want to create an integration test for my system. I'm using testcontainers to spawn my temporary database instance, and use R2DBC Database to make my system reactive. The problem is I don't know how to create a schema in R2DBC…
3
votes
1 answer

Reg different threads for flux consumer

In the below two examples, the behavior of processing a flux stream seems to be different. Example 1 : public static void main(String[] args) throws InterruptedException { log.debug(" Before reading flux stream"); Flux
3
votes
2 answers

Spring Boot, Java, Docker Compose, Getting 'Connection refused' while trying to make connection between two container (mysql, my-api)

When I execute the docker-compose up command, the following error is generated: Caused by: java.net.ConnectException: Connection refused I am trying to establish a connection between two containers, MySQL and My-API container, using docker-compose,…
XYZ
  • 83
  • 11
3
votes
3 answers

R2DBC - IllegalArgumentException: Cannot encode parameter of type java.util.Date

I'm learning Reative jdbc with R2DBC MySQL. I have a repository like this: public interface VerificationTokenRepository extends ReactiveCrudRepository { The VerificationToken class looks like this: @Table public class…
AleGallagher
  • 1,745
  • 7
  • 30
  • 40