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
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
3
votes
1 answer

R2DBC ClassCastException Long cannot cast to Int

I got the following error below. I try to find where I did it wrong between Long and Int but not found anywhere any idea? Log Error org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'initializer' defined in…
Jongz Puangput
  • 5,527
  • 10
  • 58
  • 96
3
votes
2 answers

Spring data r2dbc: Problem connecting to MySQL - Repository bean not found

I am trying to integrate MySql to spring boot application using r2dbc driver. While doing so encountering issue wherein the repository bean is not getting created. I saw similar questions but the approaches mentioned in those didn't help. Error…
Ananth
  • 787
  • 5
  • 18
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
3 answers

Why is a suspending repository function executed but a non-suspending one not?

I have this service method: @Transactional override suspend fun deleteByCarId(carId: Long) { routeRepository.deleteByCarId(carId) routePlanRepository.deleteByCarId(carId) carRepository.deleteById(carId) } The route plan (middle) and the the…
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
1 answer

How can I configure spring r2dbc to use separate read-only and read-write DB urls?

I have a Spring Webflux application with the "org.springframework.boot:spring-boot-starter-data-r2dbc" dependency for the DB connection. I also have a postgres cluster containing master and read-only replica. Both have separate URLs. I am looking…
fyrkov
  • 2,245
  • 16
  • 41
3
votes
1 answer

R2DBC can not read the URL of oracle database

I try to config the oracle's connection by using application.properties file but it gives me an IllegalArgumentException with message "Invalid URL: r2dbc:oracle:thin:@localhost:1521:orcl", it was fine when I set with the MySql URL. Here is my…
3
votes
1 answer

Execption : This publisher does not support multiple subscribers (spring data r2dbc + oracle-r2dbc)

Exception ''' org.springframework.dao.DataAccessResourceFailureException: Failed to obtain R2DBC Connection; nested exception is java.lang.IllegalStateException: This publisher does not support multiple subscribers. at…
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
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
3
votes
1 answer

Spring Data R2DBC custom conversions does not work with json array

I'm trying to get custom conversions of Spring Data R2DBC working to deal json_array fields. I have a MySQL table created by the SQL below. create table prefecture ( id bigint unsigned auto_increment, region_ids json not null, …
shota hizawa
  • 105
  • 2
  • 8